'The @app.route(path) decorator defines the handler function for the given path.
The function can take arguments (path) and keyword arguments (query data), e.g.,
if no handler exists for URL "/api/1/en", but a handler exists for URL "/api/1",
this handler will be called with 1 argument: "en".
It returns a string, a generator or a dictionary (which is parsed to a JSON-string).'

def route(self, path, limit=False, time=None, key=(lambda data: data.get('key')), reset=100000):

    _a = (key, limit, time, reset)
    def decorator(handler):
        def ratelimited(handler):
            @self.thread(START)
            def connect():
                g.rate = RateLimit(name=self._rate)
            def wrapper(*args, **kwargs):
                self = cp.request.app.root
                self.rate(ip=cp.request.remote.ip, key=_a[0](cp.request.params), path=('/' + path.strip('/')), limit=_a[1], time=_a[2], reset=_a[3])
                return handler(*args, **kwargs)
            return wrapper
        if ((limit is True) or ((limit is not False) and (limit is not None) and (time is not None))):
            handler = ratelimited(handler)
        self.router[path] = handler
        return handler
    return decorator
