diff --git a/beat/web/attestations/management/commands/send_attestation_cleanup_warning.py b/beat/web/attestations/management/commands/send_attestation_cleanup_warning.py
index fbe9df83d95d27250a74b2cc60a4bc4031517d9d..f04e542441ddd9a33a3784d1225ad788e647458b 100644
--- a/beat/web/attestations/management/commands/send_attestation_cleanup_warning.py
+++ b/beat/web/attestations/management/commands/send_attestation_cleanup_warning.py
@@ -27,48 +27,68 @@
 ###############################################################################
 
 
-from django.core.management import call_command
-from django.core.management.base import BaseCommand, CommandError
-from django.core.mail import send_mail
-from django.template.loader import render_to_string
+from datetime import date
+from datetime import datetime
+from datetime import time
+from datetime import timedelta
+
 from django.conf import settings
 from django.contrib.sites.models import Site
+from django.core.mail import send_mail
+from django.core.management import call_command
+from django.core.management.base import BaseCommand
+from django.template.loader import render_to_string
 
-from datetime import datetime, time, date, timedelta
-
-from ...models import Attestation
 from .... import __version__
+from ...models import Attestation
 
-import sys
 
 class Command(BaseCommand):
 
-    help = 'Send email warning for attestations about to expire'
+    help = "Send email warning for attestations about to expire"
 
     def handle(self, *args, **options):
         for expiration_reminder in settings.EXPIRATION_REMINDERS:
             expiration_date = date.today() + timedelta(days=expiration_reminder)
-            attestations_about_to_expire = Attestation.objects.filter(locked=True, expiration_date__range=(datetime.combine(expiration_date, time.min),
-                                                                                                           datetime.combine(expiration_date, time.max)))
+            attestations_about_to_expire = Attestation.objects.filter(
+                locked=True,
+                expiration_date__range=(
+                    datetime.combine(expiration_date, time.min),
+                    datetime.combine(expiration_date, time.max),
+                ),
+            )
             if attestations_about_to_expire:
                 current_site = Site.objects.get_current()
-                template_path = 'attestations/attestation_about_to_expire_email.txt'
+                template_path = "attestations/attestation_about_to_expire_email.txt"
                 for attestation in attestations_about_to_expire:
-                    subject = "Attestation for experiment %s is about to expire" % \
-                        attestation.experiment.fullname()
+                    subject = (
+                        "Attestation for experiment %s is about to expire"
+                        % attestation.experiment.fullname()
+                    )
 
-                    send_mail(subject,
-                              render_to_string(template_path,
-                                               {
-                                                   'attestation': attestation,
-                                                 'beat_version': __version__,
-                                                 'site': current_site,
-                                               }
-                                               ),
-                              settings.DEFAULT_FROM_EMAIL,
-                              [attestation.experiment.author.email])
-                self.stdout.write('{} attestation(s) about to expire'.format(attestations_about_to_expire.count()))
+                    send_mail(
+                        subject,
+                        render_to_string(
+                            template_path,
+                            {
+                                "attestation": attestation,
+                                "beat_version": __version__,
+                                "site": current_site,
+                            },
+                        ),
+                        settings.DEFAULT_FROM_EMAIL,
+                        [attestation.experiment.author.email],
+                    )
+                self.stdout.write(
+                    "{} attestation(s) about to expire".format(
+                        attestations_about_to_expire.count()
+                    )
+                )
             else:
-                self.stdout.write('No attestation(s) about to expire in {} day(s)'.format(expiration_reminder))
+                self.stdout.write(
+                    "No attestation(s) about to expire in {} day(s)".format(
+                        expiration_reminder
+                    )
+                )
 
-        call_command('clean_attestations', '--noinput')
+        call_command("clean_attestations", "--noinput")