input: Write a python function to track players' team switch events and enforce a 15-second delay before they can rejoin after spectating.
  assert spec_delay().spec_delays == set()
  assert spec_delay().handle_team_switch_attempt(player="player1", old_team="spectator", new_team="free") == minqlx.RET_STOP_EVENT
  assert spec_delay().handle_team_switch(player="player1", old_team="free", new_team="spectator") == None
output: def spec_delay():
      import time
      from collections import defaultdict
  
      class SpecDelay:
          def __init__(self):
              self.spec_delays = set()
              self.last_team_switch = defaultdict(float)
  
          def handle_team_switch_attempt(self, player, old_team, new_team):
              if old_team == "spectator":
                  if time.time() - self.last_team_switch[player] < 15:
                      self.spec_delays.add(player)
                      return minqlx.RET_STOP_EVENT
              return None
  
          def handle_team_switch(self, player, old_team, new_team):
              if new_team == "spectator":
                  self.last_team_switch[player] = time.time()
                  if player in self.spec_delays:
                      self.spec_delays.remove(player)
  
      return SpecDelay()