code: def _WriteFile(file_descriptor, package, version, proto_printer):
      
      proto_printer.PrintPreamble(package, version, file_descriptor)
      _PrintEnums(proto_printer, file_descriptor.enum_types)
      _PrintMessages(proto_printer, file_descriptor.message_types)
      custom_json_mappings = _FetchCustomMappings(file_descriptor.enum_types)
      custom_json_mappings.extend(
          _FetchCustomMappings(file_descriptor.message_types))
      for mapping in custom_json_mappings:
          proto_printer.PrintCustomJsonMapping(mapping)
docs: Write the given extended file descriptor to the printer.