title: Unexpected '{' in field name when doing string formatting
body: <p>I'm trying to write a small script that will automate some PHP boilerplate that I need to write. It should write a copy of the string <code>code</code> to the output file with the various replacement fields filled in for each dict in the <code>fields</code> list.</p>
  
  <p>However, I'm getting the error:</p>
  
  <pre><code>Traceback (most recent call last):
      File "writefields.py", line 43, in &lt;module&gt;
          formatted = code.format(**field)
  ValueError: unexpected '{' in field name
  </code></pre>
  
  <p>As far as I can tell, there are no extra braces in either the replacement fields or the dicts that should be causing issues, so any help would be appreciated.</p>
  
  <pre><code>code = '''
  // {label}
  add_filter( 'submit_job_form_fields', 'frontend_add_{fieldname}_field' );
  function frontend_add_{fieldname}_field($fields) {
      $fields['job']['job_{fieldname}'] = array(
          'label' =&gt; __('{label}', 'job_manager'),
          'type' =&gt; 'text',
          'required' =&gt; {required},
          'priority' =&gt; 7,
          'placeholder' =&gt; '{placeholder}'
      );
      return $fields;
  }
  add_filter( 'job_manager_job_listing_data_fields', 'admin_add_{fieldname}_field' );
  function admin_add_{fieldname}_field( $fields ) {
    $fields['_job_{fieldname}'] = array(
      'label'       =&gt; __( '{label}', 'job_manager' ),
      'type'        =&gt; 'text',
      'placeholder' =&gt; '{placeholder}',
      'description' =&gt; ''
    );
    return $fields;
  }
  '''
  
  fields = [
      {
          'fieldname': 'salary',
          'label': 'Salary ($)',
          'required': 'true',
          'placeholder': 'e.g. 20000',
      },
      {
          'fieldname': 'test',
          'label': 'Test Field',
          'required': 'true',
          'placeholder': '',
      }
  ]
  
  with open('field-out.txt', 'w') as f:
      for field in fields:
          formatted = code.format(**field)
          f.write(formatted)
          f.write('\n')
  </code></pre>