code: def save_to_file_object(self, fd, format=None, **kwargs):
          
          format = 'pickle' if format is None else format
          save = getattr(self, "save_%s" % format, None)
          if save is None:
              raise ValueError("Unknown format '%s'." % format)
          save(fd, **kwargs)
docs: Save the object to a given file like object in the given format.