def get_by_dnsname_and_port(dnsname, port):
    """
    Retrieves and endpoint by it's dnsname and port.
    :param dnsname:
    :param port:
    :return:
    """
    return (
        Endpoint.query.filter(Endpoint.dnsname == dnsname)
        .filter(Endpoint.port == port)
        .scalar()
    )

    Retrieves and endpoint by it's dnsname and port.
    :param dnsname:
    :param port:
    :return:
    
lemur/endpoints/service.py