'Calls the handler function for the given URL path.
If no handler is found, raises a RouteError.
If a base handler is found (e.g., "/api" for "/api/1/en"),
calls the handler with arguments (e.g., handler("1", "en")).'

def __call__(self, path, **data):

    if (not isinstance(path, tuple)):
        path = path.strip('/').split('/')
    n = len(path)
    for i in xrange((n + 1)):
        p0 = ('/' + '/'.join(path[:(n - i)]))
        p0 = p0.lower()
        p1 = path[(n - i):]
        if (p0 in self):
            (handler, (args, kwargs)) = self[p0]
            i = len(p1)
            j = (len(args) if (args is not True) else i)
            if ((i == 0) and (j == 1)):
                p1 = (None,)
                i = j
            if (i != j):
                continue
            if (not callable(handler)):
                return handler
            if (not kwargs):
                return handler(*p1)
            if (kwargs is True):
                return handler(*p1, **data)
            return handler(*p1, **dict(((k, v) for (k, v) in data.items() if (k in kwargs))))
    raise RouteError
