def _get_endpoint(ks_session, **kwargs):
    """Get an endpoint using the provided keystone session."""
    endpoint_type = kwargs.get('endpoint_type') or 'publicURL'
    service_type = kwargs.get('service_type') or 'metering'
    endpoint = ks_session.get_endpoint(service_type=service_type, interface
        =endpoint_type, region_name=kwargs.get('region_name'))
    return endpoint
