import socket


def is_port_in_use(port):
    """Check if the given port is in use by trying to bind to it
    Returns boolean
    """
    host = ''
    in_use = False
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        try:
            s.bind((host, port))
        except:
            in_use = True
    return in_use