def _parse_custom_url(bits, resolver=None):
    if len(bits) < 3:
        raise TemplateSyntaxError("'%s' takes at least one argument"
                                  " (path to a view)" % bits[0])
    obj = Variable(bits[1])
    viewname = bits[2]
    args = []
    kwargs = {}
    asvar = None

    if len(bits) > 3:
        bits = iter(bits[3:])
        for bit in bits:
            if bit == 'as':
                asvar = bits.next()
                break
            else:
                for arg in bit.split(","):
                    if '=' in arg:
                        k, v = arg.split('=', 1)
                        k = k.strip()
                        kwargs[k] = Variable(v)
                    elif arg:
                        args.append(Variable(arg))
    return CustomURLNode(obj, viewname, args, kwargs, asvar, resolver=resolver)
dataset/ETHPy150Open ella/ella/ella/core/templatetags/custom_urls_tags.py/_parse_custom_url/original