code: def pytest_runtest_setup(item):
      """Setup the pytest_assertrepr_compare hook
  
      The newinterpret and rewrite modules will use util._reprcompare if
      it exists to use custom reporting via the
      pytest_assertrepr_compare hook.  This sets up this custom
      comparison for the test.
      """
  
      def callbinrepr(op, left, right):
          """Call the pytest_assertrepr_compare hook and prepare the result
  
          This uses the first result from the hook and then ensures the
          following:
          * Overly verbose explanations are truncated unless configured otherwise
            (eg. if running in verbose mode).
          * Embedded newlines are escaped to help util.format_explanation()
            later.
          * If the rewrite mode is used embedded %-characters are replaced
            to protect later % formatting.
  
          The result can be formatted by util.format_explanation() for
          pretty printing.
          """
          hook_result = item.ihook.pytest_assertrepr_compare(
              config=item.config, op=op, left=left, right=right
          )
          for new_expl in hook_result:
              if new_expl:
                  new_expl = truncate.truncate_if_required(
                      new_expl, item
                  )
                  new_expl = [
                      line.replace("\n", "\\n") for line in new_expl
                  ]
                  res = six.text_type("\n~").join(new_expl)
                  if item.config.getvalue("assertmode") == "rewrite":
                      res = res.replace("%", "%%")
                  return res
  
      util._reprcompare = callbinrepr
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import sys
  import six
  from _pytest.assertion import rewrite
  from _pytest.assertion import truncate
  from _pytest.assertion import util
label_desc: Use image node_id 5 for calling a global function with example usage: pytest_runtest_setup(item) and returns: res