def is_locked(lock):
    """ The multiprocessing.Lock class does not have a locked()
    method, so we simulate it here by trying to acquire the lock
    without blocking.
    """
    if lock.acquire(block=False):
        lock.release()
        return False
    else:
        return True