code: def config_example(cog, input):
      if type(input) is str:
          data = YAML().load(input)
          output_yaml = input
      else:
          data = input
          output_yaml = safe_dump(input, sort_keys=False)
      cog.out("\n.. tab:: datasette.yaml\n\n")
      cog.out("    .. code-block:: yaml\n\n")
      cog.out(textwrap.indent(output_yaml, "        "))
      cog.out("\n\n.. tab:: datasette.json\n\n")
      cog.out("    .. code-block:: json\n\n")
      cog.out(textwrap.indent(json.dumps(data, indent=2), "        "))
      cog.out("\n")
  
imports: import json
  import textwrap
  from yaml import safe_dump
  from ruamel.yaml import YAML
label_desc: Use image node_id 2 for calling a global function with example usage: config_example(cog, input) without return types