code: def check_pairs(func, pairs):
      """Utility function for the common case of checking a function with a
      sequence of input/output pairs.
  
      Parameters
      ----------
      func : callable
        The function to be tested. Should accept a single argument.
      pairs : iterable
        A list of (input, expected_output) tuples.
  
      Returns
      -------
      None. Raises an AssertionError if any output does not match the expected
      value.
      """
      name = getattr(
          func, "func_name", getattr(func, "__name__", "<unknown>")
      )
      for inp, expected in pairs:
          out = func(inp)
          assert out == expected, pair_fail_msg.format(
              name, inp, expected, out
          )
  
imports: from __future__ import absolute_import
  import os
  import re
  import sys
  import tempfile
  from contextlib import contextmanager
  from io import StringIO
  from subprocess import Popen, PIPE
  from traitlets.config.loader import Config
  from IPython.utils.process import get_output_error_code
  from IPython.utils.text import list_strings
  from IPython.utils.io import temp_pyfile, Tee
  from IPython.utils import py3compat
  from IPython.utils.encoding import DEFAULT_ENCODING
  from .None import decorators
  from .None import skipdoctest
label_desc: Use image node_id 8 for calling a global function with example usage: check_pairs(func, pairs) without return types