def current_service(request):
 if request.matched_route:
  services = request.registry.cornice_services
  pattern = request.matched_route.pattern
  try:
   service = services[pattern]
  except KeyError:
   return None
  else:
   return service

def current_service ( request ) : if request . matched_route : services = request . registry . cornice_services pattern = request . matched_route . pattern try : service = services [ pattern ] except KeyError : return None else : return service
return the cornice service matching the specified request .