def register(self, http_server):
        """ Register this servlet with the given HTTP server. """
        if hasattr(self, "PATTERNS"):
            patterns = self.PATTERNS

            for method in ("GET", "PUT", "POST", "OPTIONS", "DELETE"):
                if hasattr(self, "on_%s" % (method,)):
                    method_handler = getattr(self, "on_%s" % (method,))
                    http_server.register_paths(method, patterns, method_handler)

        else:
            raise NotImplementedError("RestServlet must register something.")
dataset/ETHPy150Open matrix-org/synapse/synapse/http/servlet.py/RestServlet.register/original