jinja 2 nested dictionaries to yaml
<p>I'm trying to use jinja2 to output a nested dictionary to a yaml file. However I'm not sure how to access the nested dicts. 
With a flat dict for data I can use the below.</p>

<pre><code> - request:
        path: {{ path }}
        headers:
          origin: 'somedomain.com'
          user-agent: 'agent'
          referer: 'some.domain.com'
          authority: 'somedomain.com'
        data:
          {% for key, value in data.items() -%}
          {{ key }}: '{{ value }}'
          {%- endfor %}
      response:
        content:
          file: {{ content }}
</code></pre>

<p>However with a nested dict like below how do I achieve the output at the bottom?</p>

<pre><code>{'toplevelkey1': {'nestedkey1': 'value1', 'nestedkey2': 123, 'nestedkey3': '55',
                 'nestedkey4': 1560}, 'toplevelkey34': 'df',
 'toplevelkey2': {'somekey12': 68, 'somekey58': False, 'somekey48': 3, 'somekey38': 'ADF',
                              'somekey39': 'St'}, 'toplevel34': 'T',
 'toplevel8': {'key33': 68, 'key94': 3, 'key83': 'T', 'key84': 'dog'}}
</code></pre>

<p>Required output</p>

<pre><code>   - request:
    path: /some/path
    headers:
      origin: 'somedomain.com'
      user-agent: 'agent'
      referer: 'somedomain.com'
      authority: 'somedomain.com'
    data:
      toplevelkey1: 
        nestedkey1: 'value1'
        nestedkey2: '123
        ....      : ....
      toplevel34: 'T'
      toplevelkey2:
        'somekey12': 68
         .....     :  .....
  response:
    content:
      file: address.json
</code></pre>