input: Write a python function to scan a range of ports on a given IP address using threading.
  assert scan("127.0.0.1", [80, 443, 8080]) is None
  assert scan("192.168.1.1", [22, 80, 443]) is None
  assert scan("8.8.8.8", [53, 80]) is None
output: import threading
  import socket
  
  def scan(ip, ports):
      def check_port(port):
          s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
          s.settimeout(1)
          try:
              s.connect((ip, port))
              print(f"Port {port} is open on {ip}")
          except:
              print(f"Port {port} is closed on {ip}")
          finally:
              s.close()
  
      threads = []
      for port in ports:
          t = threading.Thread(target=check_port, args=(port,))
          threads.append(t)
          t.start()
  
      for t in threads:
          t.join()