code: def handle_noargs(self, **options):
          
  
          r = get_r()
          since = datetime.utcnow() - timedelta(days=1)
          metrics = {}
          categories = r.metric_slugs_by_category()
          for category_name, slug_list in categories.items():
              metrics[category_name] = []
              for slug in slug_list:
                  metric_values = r.get_metric_history(slug, since=since)
                  metrics[category_name].append(
                      (slug, metric_values)
                  )
  
          # metrics is now:
          # --------------
          # { Category : [
          #     ('foo', [('m:foo:2012-07-18', 1), ('m:foo:2012-07-19, 2), ...])
          #   ],
          #   ...
          # }
  
          template = "redis_metrics/email/report.{fmt}"
          data = {
              'today': since,
              'metrics': metrics,
          }
  
          message = render_to_string(template.format(fmt='txt'), data)
          message_html = render_to_string(template.format(fmt='html'), data)
          msg = EmailMultiAlternatives(
              subject="Redis Metrics Report",
              body=message,
              from_email=settings.DEFAULT_FROM_EMAIL,
              to=[email for name, email in settings.ADMINS]
          )
          msg.attach_alternative(message_html, "text/html")
          msg.send()
docs: Send Report E-mails.