def parse_url_name_args(string):
    """
    Parse and return url_name and kwargs as a tuple from the node's
    url_name parameter (which can be just the url_name or additionally define
    some kwargs)

    Example: node['url_name'] = 'url_name|kwarg1:value,kwarg2:value'

    """
    chunks = string.split('|')
    url_name = chunks[0]
    kwargs = {}
    if len(chunks) > 1:
        for pair in chunks[1].split(','):
            k, v = pair.strip().split(':')
            k = k.strip()
            v = v.strip()
            if k and v:
                kwargs[k] = v
    return url_name, kwargs
