def get_listener_arn_from_endpoint(endpoint_name, endpoint_port, **kwargs):
    """
    Get a listener ARN from an endpoint.
    :param endpoint_name:
    :param endpoint_port:
    :return:
    """
    try:
        client = kwargs.pop("client")
        elbs = client.describe_load_balancers(Names=[endpoint_name])
        for elb in elbs["LoadBalancers"]:
            listeners = client.describe_listeners(
                LoadBalancerArn=elb["LoadBalancerArn"]
            )
            for listener in listeners["Listeners"]:
                if listener["Port"] == endpoint_port:
                    return listener["ListenerArn"]
    except Exception as e:  # noqa
        metrics.send(
            "get_listener_arn_from_endpoint_error",
            "counter",
            1,
            metric_tags={
                "error": str(e),
                "endpoint_name": endpoint_name,
                "endpoint_port": endpoint_port,
            },
        )
        capture_exception(
            extra={
                "endpoint_name": str(endpoint_name),
                "endpoint_port": str(endpoint_port),
            }
        )
        raise

    Get a listener ARN from an endpoint.
    :param endpoint_name:
    :param endpoint_port:
    :return:
    
lemur/plugins/lemur_aws/elb.py