code: def make_file_cm(filename, mode='a'):
      '''
      Open a file for appending and yield the open filehandle.  Close the 
      filehandle after yielding it.  This is useful for creating a context
      manager for logging the output of a `Vagrant` instance.
  
      filename: a path to a file
      mode: The mode in which to open the file.  Defaults to 'a', append
  
      Usage example:
  
          log_cm = make_file_cm('application.log')
          v = Vagrant(out_cm=log_cm, err_cm=log_cm)
      '''
      @contextlib.contextmanager
      def cm():
          with open(filename, mode=mode) as fh:
              yield fh
  
      return cf make_file_cm(filename, mode='a'):
      '''
      Open a file for appending and yield the open filehandle.  Close the 
      filehandle after yielding it.  This is useful for creating a context
      manager for logging the output of a `Vagrant` instance.
  
      filename: a path to a file
      mode: The mode in which to open the file.  Defaults to 'a', append
  
      Usage example:
  
          log_cm = make_file_cm('application.log')
          v = Vagrant(out_cm=log_cm, err_cm=log_cm)
      '''
      @contextlib.contextmanager
      def cm():
          with open(filename, mode=mode) as fh:
              yield fh
  
      return cm
docs: Open a file for appending and yield the open filehandle.  Close the 
      filehandle after yielding it.  This is useful for creating a context
      manager for logging the output of a `Vagrant` instance.
  
      filename: a path to a file
      mode: The mode in which to open the file.  Defaults to 'a', append
  
      Usage example:
  
          log_cm = make_file_cm('application.log')
          v = Vagrant(out_cm=log_cm, err_cm=log_cm)