title: Converting timezone-aware datetime to local time in Python
body: <p>How do you convert a timezone-aware datetime object to the equivalent non-timezone-aware datetime for the local timezone?</p>
  
  <p>My particular application uses Django (although, this is in reality a generic Python question):</p>
  
  <pre><code>import iso8601
  </code></pre>
  
  <p>....</p>
  
  <pre><code>date_str="2010-10-30T17:21:12Z"
  </code></pre>
  
  <p>....</p>
  
  <pre><code>d = iso8601.parse_date(date_str)
  
  foo = app.models.FooModel(the_date=d)
  foo.save()
  </code></pre>
  
  <p>This causes Django to throw an error:     </p>
  
  <pre><code>raise ValueError("MySQL backend does not support timezone-aware datetimes.")
  </code></pre>
  
  <p>What I need is:</p>
  
  <pre><code>d = iso8601.parse_date(date_str)
  local_d = SOME_FUNCTION(d)
  foo = app.models.FooModel(the_date=local_d)
  </code></pre>
  
  <p>What would <strong>SOME_FUNCTION</strong> be?</p>