code: def dump_with_fn(dump_fn, data, stream, **options):
      
      if stream is None:
          return dump_fn(data, **options)
  
      return dump_fn(data, stream, **options)
docs: Dump 'data' to a string if 'stream' is None, or dump 'data' to a file or
      file-like object 'stream'.
  
      :param dump_fn: Callable to dump data
      :param data: Data to dump
      :param stream:  File or file like object or None
      :param options: optional keyword parameters
  
      :return: String represents data if stream is None or None