code: def format_as_all(res, clf, **kwargs):
      """Format explanation as text and html, check JSON-encoding,
      print text explanation, save html, return text and html.
      """
      expl_dict = format_as_dict(res)
      pprint(expl_dict)
      json.dumps(expl_dict)  # check that it can be serialized to JSON
      expl_text = format_as_text(res, **kwargs)
      expl_html = format_as_html(res, **kwargs)
      print(expl_text)
      write_html(clf, expl_html, expl_text, caller_depth=2)
      return expl_text, expl_html
  
file_path: eli5/tests/utils.py
imports: from __future__ import print_function
  import os
  import inspect
  import json
  from pprint import pprint
  from hypothesis.strategies import integers
  from hypothesis.extra.numpy import arrays
  import numpy
  from eli5.base import Explanation
  from eli5.formatters import format_as_text, format_as_html, format_as_dict
  from eli5.formatters.html import html_escape
  from eli5.formatters.text import format_signed
  from eli5.sklearn.utils import sklearn_version
label_desc: Use image node_id 2 for calling a global function with example usage: format_as_all(res, clf) and returns: expl_text,  expl_html