title: json.dumps doesn't work for me
body: <p>I wrote a small Python script to get a response from GitHub and its GraphQL API.</p>
  
  <p>Here is what I coded:</p>
  
  <pre><code>import json
  def pp_json(json_thing, sort=True, indents=4):
      if type(json_thing) is str:
          print(json.dumps(json.loads(json_thing),sort_key=sort, indent=indents))
      else:
          print(json.dumps(json_thing, sort_key=sort, indent=indents))
      return None
  </code></pre>
  
  <p>I start this function with the output of my request as you can see here:</p>
  
  <pre><code>url = 'https://api.github.com/graphql'
  json = { "query" : """query {
    viewer {
      login
      name
      bio
      company
      location
    }
  }""" 
          }
  api_token = "hiddencontent"
  headers = {'Authorization': 'token %s' % api_token}
  
  result_tokentest = requests.post(url=url, json=json, headers=headers) # just Response Code
  string_tokentest = result_tokentest.text
  
  print (result_tokentest)
  print (string_tokentest)
  pp_json(result_tokentest)
  </code></pre>
  
  <p>I get following output:</p>
  
  <pre><code>&lt;Response [200]&gt;
  {"data":{"viewer":{"login":"datasienceelmo","name":"E.Lmo","bio":"Rohdaten sind geil!!","company":"Hochschule Ulm","location":"Ulm"}}}
  
  --------------------------------------------------------------------------- AttributeError                            Traceback (most recent call last) &lt;ipython-input-12-9c2eefbf15a2&gt; in &lt;module&gt;()
       19 print (result_tokentest)
       20 print (string_tokentest)
  ---&gt; 21 pp_json(result_tokentest)
  
  &lt;ipython-input-2-f2241ef62766&gt; in pp_json(json_thing, sort, indents)
        4         print(json.dumps(json.loads(json_thing),sort_key=sort, indent=indents))
        5     else:
  ----&gt; 6         print(json.dumps(json_thing, sort_key=sort, indent=indents))
        7     return None
  
  AttributeError: 'dict' object has no attribute 'dumps'
  </code></pre>
  
  <p>I am unable to understand what the problem with my Python interpreter is, because I imported JSON. And in the documentation I just read how to use it, and I did as they did.</p>