code: def directive_fun(match, directive):
      """Helper to fill in directives"""
      directive_to_alert = dict(note="info", warning="danger")
      return '<div class="alert alert-{0}"><h4>{1}</h4><p>{2}</p></div>'.format(
          directive_to_alert[directive],
          directive.capitalize(),
          match.group(1).strip(),
      )
  
file_path: tensorly/doc/sphinx_ext/sphinx_gallery/notebook.py
imports: from __future__ import division, absolute_import, print_function
  from functools import partial
  import argparse
  import json
  import re
  import sys
  from .py_source_parser import split_code_and_text_blocks
label_desc: Use image node_id 2 for calling a global function with example usage: directive_fun(match, directive) and returns: str