def route_pattern_match(route, path):
    """
    Backport of RegexPattern.match for Django versions before 2.0. Returns
    the remaining path and positional and keyword arguments matched.
    """
    if hasattr(route, 'pattern'):
        match = route.pattern.match(path)
        if match:
            path, args, kwargs = match
            kwargs.update(route.default_args)
            return path, args, kwargs
        return match
    match = route.regex.search(path)
    if match:
        kwargs = match.groupdict()
        args = () if kwargs else match.groups()
        if kwargs is not None:
            kwargs.update(route.default_args)
        return path[match.end():], args, kwargs
    return None
