<jupyter_start><jupyter_text>List FormatsList the formatIds registered in DataONE using the listFormts method.<jupyter_code># include some utility data and methods
import notebook_utils as nbu

# Import the library and create a client instance
from d1_client import cnclient_2_0

cn_base_url = "https://cn.dataone.org/cn"
client = cnclient_2_0.CoordinatingNodeClient_2_0(base_url=cn_base_url)

formats = client.listFormats()

print(nbu.asXml(formats))
for fmt in formats.objectFormat:
    print(fmt.formatId)
    print(f"  {fmt.formatType}")
    media_type = ""
    if fmt.mediaType is not None:
        media_type = fmt.mediaType.name
    ext = ""
    if fmt.extension is not None:
        ext = fmt.extension
    print(f"  {ext:4} {media_type}")
    print(f"  {fmt.formatName}")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09753086419753086, 'fraction_numerical': 0.009876543209876543, 'mean_word_length': 4.370860927152318, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '448783', 'license': 'Apache-2.0', 'n_tokens_mistral': 280, 'n_tokens_neox': 282, 'n_words': 68, 'path': 'python_examples/05_listFormats.ipynb', 'repo_name': 'DataONEorg/dataone_examples', 'size': '810'}