def _parse_route_template(template, default_sufix=''):
    """Lazy route template parser."""
    variables = {}
    reverse_template = pattern = ''
    args_count = last = 0
    for match in _route_re.finditer(template):
        part = template[last:match.start()]
        name = match.group(1)
        expr = match.group(2) or default_sufix
        last = match.end()

        if not name:
            name = '__%d__' % args_count
            args_count += 1

        pattern += '%s(?P<%s>%s)' % (re.escape(part), name, expr)
        reverse_template += '%s%%(%s)s' % (part, name)
        variables[name] = re.compile('^%s$' % expr)

    part = template[last:]
    kwargs_count = len(variables) - args_count
    reverse_template += part
    regex = re.compile('^%s%s$' % (pattern, re.escape(part)))
    return regex, reverse_template, args_count, kwargs_count, variables
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/webapp2-2.5.1/webapp2.py/_parse_route_template/original