def METHOD_NAME(j, session_type, name):
    # Format a JSON dict, wrap it in clickable expanding links and
    # save it to a file for the docs to include.
    json_dumps = lambda d: json.dumps(d, indent=2, sort_keys=True, default=lambda t: f'{t}')
    j = '\n'.join([f'  {l}' for l in json_dumps(j).split('\n')])
    suffix = f'_{session_type}' if session_type else ''
    title = 'Example'
    if session_type:
        title = f'{session_type.replace("_", " ").title()} example'
    with open(f'./docs/source/examples/{name}{suffix}.json', 'w') as f:
        f.write('.. raw:: html\n')
        f.write('\n')
        f.write('  <details>\n')
        f.write(f'  <summary><a>{title}</a></summary>\n')
        f.write('\n')
        f.write('.. code-block:: json\n')
        f.write('\n')
        f.write(f'{j}')
        f.write('\n')
        f.write('\n')
        f.write('.. raw:: html\n')
        f.write('\n')
        f.write('  </details>\n')
        f.write('\n')