code: def format_explanation(explanation):
      """This formats an explanation
  
      Normally all embedded newlines are escaped, however there are
      three exceptions: \n{, \n} and \n~.  The first two are intended
      cover nested explanations, see function and attribute explanations
      for examples (.visit_Call(), visit_Attribute()).  The last one is
      for when one explanation needs to span multiple lines, e.g. when
      displaying diffs.
      """
      explanation = ecu(explanation)
      lines = _split_explanation(explanation)
      result = _format_lines(lines)
      return "\n".join(result)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import pprint
  import six
  import _pytest._code
  from ..compat import Sequence
  from _pytest import outcomes
  from _pytest._io.saferepr import saferepr
  from _pytest.compat import ATTRS_EQ_FIELD
label_desc: Use image node_id 2 for calling a global function with example usage: format_explanation(explanation) and returns: str