'Initialize a TSocket
TSocket can be initialized in 3 ways:
* host + port. can configure to use AF_INET/AF_INET6
* unix_socket
* socket. should pass already opened socket here.
@param host(str)    The host to connect to.
@param port(int)    The (TCP) port to connect to.
@param unix_socket(str) The filename of a unix socket to connect to.
@param sock(socket)     Initialize with opened socket directly.
If this param used, the host, port and unix_socket params will
be ignored.
@param socket_family(str) socket.AF_INET or socket.AF_INET6. only
take effect when using host/port
@param socket_timeout   socket timeout in ms
@param connect_timeout  connect timeout in ms, only used in
connection, will be set to socket_timeout if not set.'

def __init__(self, host=None, port=None, unix_socket=None, sock=None, socket_family=socket.AF_INET, socket_timeout=3000, connect_timeout=None):

    if sock:
        self.sock = sock
    elif unix_socket:
        self.unix_socket = unix_socket
        self.host = None
        self.port = None
        self.sock = None
    else:
        self.unix_socket = None
        self.host = host
        self.port = port
        self.sock = None
    self.socket_family = socket_family
    self.socket_timeout = ((socket_timeout / 1000) if socket_timeout else None)
    self.connect_timeout = ((connect_timeout / 1000) if connect_timeout else self.socket_timeout)
