import socket
import errno


def socket_in_use(address, port):
    """
    Checks whether a given address+port is in use.
    """

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

    try:
        s.bind((address, port))
        return False
    except socket.error as e:
        if e.errno == errno.EADDRINUSE:
            print("Port is already in use")
            return True
        else:
            # something else raised the socket.error exception
            print(e)
            return True