def gen_url_name(resource):
    """ URL name for resource class generator. """
    if resource._meta.parent:
        yield resource._meta.parent._meta.url_name
    if resource._meta.prefix:
        yield resource._meta.prefix
    for p in resource._meta.url_params:
        yield p
    yield resource._meta.name
