import socket


def is_port_in_use(port: int) -> bool:
    """
    Check if a porty is in use.
    """
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        return s.connect_ex(('localhost', port)) == 0