code: def exfile_open(filename, *args, **kwargs):
      """Extended file opener enables open(filename=None).
  
      This context manager enables open(filename=None) as well as regular file.
      filename None will produce endlessly None for each iterate,
      while filename with valid path will produce lines as usual.
  
      Args:
          filename (str|None): a valid file path or None;
          *args: args relate to open file using codecs;
          **kwargs: kwargs relate to open file using codecs.
  
      Yields:
          `None` repeatly if filename==None,
          else yield from file specified in `filename`.
      """
      if filename is None:
          from itertools import repeat
  
          _file = repeat(None)
      else:
          import codecs
  
          _file = codecs.open(filename, *args, **kwargs)
      yield _file
      if filename is not None and _file:
          _file.close()
  
imports: import os
  from onmt.utils.logging import logger
  from onmt.constants import CorpusName, CorpusTask
  from onmt.transforms import TransformPipe
  from onmt.inputters.text_utils import process, parse_features, append_features_to_text
  from contextlib import contextmanager
  import itertools
label_desc: Use image node_id 1 for calling a global function with example usage: exfile_open(filename) without return types