def is_lock(lock):
    """
    Tests if the given lock is an instance of a lock class
    """
    if lock is None:
        return False
    for attr in ('acquire', 'release', '__enter__', '__exit__'):
        if not hasattr(lock, attr):
            return False
    return True
