code: def is_locked(self):
          
          now = datetime.datetime.utcnow()
          if self.locked_until and self.locked_until >= now:
              return True
          elif self.locked_until and self.locked_until < now:
              self.unlock_account()
              return False
          else:
              return False
docs: Is locked?
          Checks locking and possibly unlocks upon timeout if account was
          previously locked.