code: def fake_input(inputs):
      """Temporarily replace the input() function to return the given values
  
      Use as a context manager:
  
      with fake_input(['result1', 'result2']):
          ...
  
      Values are returned in order. If input() is called again after the last value
      was used, EOFError is raised.
      """
      it = iter(inputs)
  
      def mock_input(prompt=""):
          try:
              return next(it)
          except StopIteration:
              raise EOFError("No more inputs given")
  
      input_name = "%s.%s" % (
          py3compat.builtin_mod_name,
          "input" if py3compat.PY3 else "raw_input",
      )
      return patch(input_name, mock_input)
  
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 11 for calling a global function with example usage: fake_input(inputs) and returns: patch, next