code: def _diff_text(left, right, verbose=0):
      """Return the explanation for the diff between text or bytes.
  
      Unless --verbose is used this will skip leading and trailing
      characters which are identical to keep the diff minimal.
  
      If the input are bytes they will be safely converted to text.
      """
      from difflib import ndiff
  
      explanation = []
  
      def escape_for_readable_diff(binary_text):
          """
          Ensures that the internal string is always valid unicode, converting any bytes safely to valid unicode.
          This is done using repr() which then needs post-processing to fix the encompassing quotes and un-escape
          newlines and carriage returns (#429).
          """
          r = six.text_type(repr(binary_text)[1:-1])
          r = r.replace(r"\n", "\n")
          r = r.replace(r"\r", "\r")
          return r
  
      if isinstance(left, bytes):
          left = escape_for_readable_diff(left)
      if isinstance(right, bytes):
          right = escape_for_readable_diff(right)
      if verbose < 1:
          i = 0  # just in case left or right has zero length
          for i in range(min(len(left), len(right))):
              if left[i] != right[i]:
                  break
          if i > 42:
              i -= 10  # Provide some context
              explanation = [
                  "Skipping %s identical leading characters in diff, use -v to show"
                  % i
              ]
              left = left[i:]
              right = right[i:]
          if len(left) == len(right):
              for i in range(len(left)):
                  if left[-i] != right[-i]:
                      break
              if i > 42:
                  i -= 10  # Provide some context
                  explanation += [
                      "Skipping {} identical trailing "
                      "characters in diff, use -v to show".format(i)
                  ]
                  left = left[:-i]
                  right = right[:-i]
      keepends = True
      if left.isspace() or right.isspace():
          left = repr(str(left))
          right = repr(str(right))
          explanation += [
              "Strings contain only whitespace, escaping them using repr()"
          ]
      explanation += [
          line.strip("\n")
          for line in ndiff(
              left.splitlines(keepends), right.splitlines(keepends)
          )
      ]
      return explanation
  
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 13 for calling a global function with example usage: _diff_text(left, right, verbose) and returns: explanation, r