import socket


def _can_connect(ip, port):
    """Checks if a TCP port at IP address is possible to connect to"""
    cs = socket.socket()
    try:
        cs.connect((ip, port))
        cs.close()
        return True
    except socket.error:
        return False