def METHOD_NAME(app, pagename, templatename, context, doctree):
    """ Add CSS and JS asset files """
    if doctree is None:
        return
    visitor = _FindTabsDirectiveVisitor(doctree)
    doctree.walk(visitor)
    assets = ['sphinx_tabs/' + f for f in FILES]
    css_files = [posixpath.join('_static', path)
                 for path in assets if path.endswith('css')]
    script_files = [posixpath.join('_static', path)
                    for path in assets if path.endswith('js')]
    if visitor.found_tabs_directive:
        if 'css_files' not in context:
            context['css_files'] = css_files
        else:
            context['css_files'].extend(css_files)
        if 'script_files' not in context:
            context['script_files'] = script_files
        else:
            context['script_files'].extend(script_files)
    else:
        for path in css_files:
            if 'css_files' in context and path in context['css_files']:
                context['css_files'].remove(path)
        for path in script_files:
            if 'script_files' in context and path in context['script_files']:
                context['script_files'].remove(path)