code: def mock_open(*args, **kargs):
      # work-around for [MagicMock objects not being iterable](http://bugs.python.org/issue21258)
      # cf. http://stackoverflow.com/questions/24779893/customizing-unittest-mock-mock-open-for-iteration
      f_open = unittest.mock.mock_open(*args, **kargs)
      f_open.return_value.__iter__ = lambda self: iter(
          self.readline, ""
      )
      return f_open
  
file_path: sockeye/test/unit/test_translate.py
imports: import io
  import os
  import unittest
  import unittest.mock
  from tempfile import TemporaryDirectory
  import sockeye.constants
  import sockeye.inference
  import sockeye.output_handler
  import sockeye.translate
label_desc: Use image node_id 1 for calling a global function with example usage: mock_open() and returns: f_open