import socket


def is_unused_port(port, protocol):
    """
    Check whether the port is unused
    Args:
        port (int): port
        protocol (str): application protocol (tcp or udp)
    Return:
        bool: whether the port is unused
    """
    protocols = {
        'udp': socket.SOCK_DGRAM,
        'tcp': socket.SOCK_STREAM,
    }
    sock = socket.socket(family=socket.AF_INET, type=protocols[protocol])
    try:
        sock.bind(('127.0.0.1', port))
        sock.close()
        return True
    except socket.error:
        return False