def METHOD_NAME(host, port, timeout=1):
    """
    function to test socket connection to host:port.
    :param host: ip address or host name
    :param port: port
    :param timeout: connection timeout
    :return:  0 - on successful connection
             -1 - on any exception, or specific connection errors with that error number
             other values - on other connection errors
    """
    try:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(timeout)
        ret = sock.connect_ex((host, port))
        sock.close()
        return ret
    except socket.gaierror as e:
        logger.debug('could not resolve hostname "{HOST}": {ERROR}'.format(HOST=host, ERROR=e))
        return -1
    except Exception as e:
        logger.debug('socket_connect {}'.format(e))
        return -1