'If expired, mark the task as revoked.'

def maybe_expire(self):

    if self.expires:
        now = datetime.now(self.expires.tzinfo)
        if (now > self.expires):
            revoked_tasks.add(self.id)
            return True
