code: def create_client(addr, port):
      
      sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  
      # First attempt to connect otherwise it leaves
      # an unconnected spin instance in the reactor.
      sock.connect_ex((addr, port))
  
      spin = Spin(sock)
      Client(spin)
      spin.add_map(CONNECT, install_basic_handles)
      spin.add_map(CONNECT_ERR, lambda con, err: lose(con))
      return spin
docs: Set up a TCP client and installs the basic handles Stdin, Stdout.
  
      def send_data(client):
          client.dump('GET / HTTP/1.1\r\n')
          xmap(client, LOAD, iostd.put)
  
      client = create_client('www.google.com.br', 80)
      xmap(client, CONNECT, send_data)