def get_model_handler(self, model_name, method_name, failure_code=404):
        """Returns the ModelHandler with the given name, or None (and sets
        the error code given) if there is no handler with the given name."""

        # see if namespace was specified, e.g. "<ns>.<model_name>"
        ns_model_name = model_name.rpartition(".")
        if(ns_model_name[0]):
            # only set namespace if callers are allowed to
            if WRITE_EXT_NS not in self.external_namespaces:
                raise DispatcherException(404)
            namespace_manager.set_namespace(ns_model_name[0])
            # remove namespace from model name
            model_name = ns_model_name[2]

        try:
            model_handler = self.model_handlers[model_name]
        except __HOLE__:
            logging.error("invalid model name %s", model_name, exc_info=1)
            raise DispatcherException(failure_code)

        if method_name not in model_handler.model_methods:
            raise DispatcherException(405)

        return model_handler
dataset/ETHPy150Open jahlborn/appengine-rest-server/src/main/python/rest/__init__.py/Dispatcher.get_model_handler