def METHOD_NAME(name):
    from ckan.lib.helpers import url_for_static_or_external
    try:
        if not g.webassets:
            raise AttributeError(u'WebAssets not initialized yet')
    except AttributeError:
        g.webassets = _make_asset_collection()
    if name in g.webassets[u'included']:
        return
    try:
        bundle = env[name]
    except KeyError:
        logger.error(u'Trying to include unknown asset: <{}>'.format(name))
        return
    deps = bundle.extra.get(u'preload', [])
    # Using DFS may lead to infinite recursion(unlikely, because
    # extensions rarely depends on each other), so there is a sense to
    # memoize visited routes.
    # TODO: consider infinite loop prevention for assets that depends
    # on each other
    for dep in deps:
        METHOD_NAME(dep)
    # Add `site_root` if configured
    urls = [url_for_static_or_external(url) for url in bundle.urls()]
    type_ = None
    for url in urls:
        link = url.split(u'?')[0]
        if link.endswith(u'.css'):
            type_ = u'style'
            break
        elif link.endswith(u'.js'):
            type_ = u'script'
            break
    else:
        logger.warn(u'Undefined asset type: {}'.format(urls))
        return
    g.webassets[type_].extend(urls)
    g.webassets[u'included'].add(name)