def _get_service_endpoint(context, svc, region=None, public=True):
 region = _safe_region(region)
 context = (context or identity)
 url_type = {True: 'public', False: 'private'}[public]
 svc_obj = context.services.get(svc)
 if (not svc_obj):
  return None
 ep = svc_obj.endpoints.get(region, {}).get(url_type)
 if (not ep):
  ep = svc_obj.endpoints.get('ALL', {}).get(url_type)
 return ep

def _get_service_endpoint ( context , svc , region = None , public = True ) : region = _safe_region ( region ) context = ( context or identity ) url_type = { True : 'public' , False : 'private' } [ public ] svc_obj = context . services . get ( svc ) if ( not svc_obj ) : return None ep = svc_obj . endpoints . get ( region , { } ) . get ( url_type ) if ( not ep ) : ep = svc_obj . endpoints . get ( 'ALL' , { } ) . get ( url_type ) return ep
parses the services dict to get the proper endpoint for the given service .