code: def create_tcp_socket (self, host):
          
          port = int(self['TCPSocket'])
          sockinfo = get_sockinfo(host, port=port)
          sock = create_socket(socket.AF_INET, socket.SOCK_STREAM)
          try:
              sock.connect(sockinfo[0][4])
          except socket.error:
              sock.close()
              raise
          return sock
docs: Create tcp socket, connect to it and return socket object.