import socket


def is_port_available(port):
    """
    Checks if the port is available
    """
    if not port:
        return True

    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    # if result is 0, port is taken
    result = sock.connect_ex(('127.0.0.1', port))
    return result != 0