def isLockedOut(user, lock):
    """Function to check whether a user is locked from accessing a given object."""
    
    if lock is not None and lock.is_expired()==False and lock.owner!=user:
        return True
    else:
        return False