code: def get_midnight():
      
      limit = now()
      if settings.USE_TZ:
          limit = localtime(limit)
      return limit.replace(hour=0, minute=0, second=0, microsecond=0)
docs: Return last midnight in localtime as datetime.
  
      @return: Midnight datetime