code: def replace_sys_args(new_args):
      
      # Replace sys.argv arguments
      # for module import
      old_args = sys.argv
      sys.argv = new_args
      try:
          yield
      finally:
          sys.argv = old_args
docs: Temporarily replace sys.argv with current arguments
  
      Restores sys.argv upon exit of the context manager.