title: Python: How do I mock datetime.utcnow()?
body: <p>I have the below:</p>
  
  <pre><code>from datetime import datetime
  
  def get_report_month_key():
      month_for_report = datetime.utcnow()
      return month_for_report.strftime("%Y%m") 
  </code></pre>
  
  <p>How do I mock datetime.utcnow() so that I can write unit test on this function?</p>
  
  <p>Tried reading this <a href="https://stackoverflow.com/questions/4481954/python-trying-to-mock-datetime-date-today-but-not-working">one</a> but I am unable to get it working for me on utcnow()</p>