'Ensure we are currently in one of the given `states` or wait until
we enter one of those states.
Note that due to the nature of the function, you cannot guarantee that
the entirety of some operation completes while you remain in a given
state.  That would require acquiring and holding a lock, which
would mean no other threads could do the same.  (You\'d essentially
be serializing all of the threads that are \'ensuring\' their tasks
occurred in some state.'

def ensure_any(self, states, wait=0.0, block_on_transition=False):

    if (not (isinstance(states, tuple) or isinstance(states, list))):
        raise ValueError('states    arg    should    be    a    tuple    or    list')
    for state in states:
        if (not (state in self.__states)):
            raise ValueError(("StateMachine    does    not    contain    state    '%s'" % state))
    self.lock.acquire()
    start = time.time()
    while (not (self.__current_state in states)):
        remainder = ((start + wait) - time.time())
        if (remainder > 0):
            self.lock.wait(remainder)
        else:
            self.lock.release()
            return False
    self.lock.release()
    return True
