code: def endpoint_routing(self, context):
          
          if context.path is None:
              satosa_logging(logger, logging.DEBUG, "Context did not contain a path!", context.state)
              raise SATOSABadContextError("Context did not contain any path")
  
          satosa_logging(logger, logging.DEBUG, "Routing path: %s" % context.path, context.state)
          path_split = context.path.split("/")
          backend = path_split[0]
  
          if backend in self.backends:
              context.target_backend = backend
          else:
              satosa_logging(logger, logging.DEBUG, "Unknown backend %s" % backend, context.state)
  
          try:
              name, frontend_endpoint = self._find_registered_endpoint(context, self.frontends)
          except ModuleRouter.UnknownEndpoint as e:
              pass
          else:
              context.target_frontend = name
              return frontend_endpoint
  
          try:
              name, micro_service_endpoint = self._find_registered_endpoint(context, self.micro_services)
          except ModuleRouter.UnknownEndpoint as e:
              pass
          else:
              context.target_micro_service = name
              return micro_service_endpoint
  
          if backend in self.backends:
              backend_endpoint = self._find_registered_backend_endpoint(context)
              if backend_endpoint:
                  return backend_endpoint
  
          raise SATOSANoBoundEndpointError("'{}' not bound to any function".format(context.path))
docs: Finds and returns the endpoint function bound to the path
  
          :type context: satosa.context.Context
          :rtype: ((satosa.context.Context, Any) -> Any, Any)
  
          :param context: The request context
          :return: registered endpoint and bound parameters