code: def save(diff, stream=sys.stdout, compact=False):
      "Serialize a patch object."
      flags = {'sort_keys': True}
      if not compact:
          flags['indent'] = 2
  
      json.dump(diff, stream, **flagsf save(diff, stream=sys.stdout, compact=False):
      "Serialize a patch object."
      flags = {'sort_keys': True}
      if not compact:
          flags['indent'] = 2
  
      json.dump(diff, stream, **flags)
docs: Serialize a patch object.