code: def write_json(metadata):
          
          # Open the metadata file to write
          with open(metadata.jsonfile, 'w') as metadatafile:
              # Write the json dump of the object dump to the metadata file
              json.dump(metadata.dump(), metadatafile, sort_keys=True, indent=4, separators=(',', ': '))
docs: Write the metadata object to file
          :param metadata: Metadata object