'Static method to return in a given user has his/her account locked out'

@classmethod
def is_user_locked_out(cls, user):

    try:
        record = cls._get_record_for_user(user)
        if (not record.lockout_until):
            return False
        now = datetime.now(UTC)
        until = record.lockout_until
        is_locked_out = (until and (now < until))
        return is_locked_out
    except ObjectDoesNotExist:
        return False
