code: def add_conditional_state(self, name, state, validator, class_validator=None, cache_for=None, label=None):
          
          # We'll accept a ManagedState with grouped values, but not a ManagedStateGroup
          if not isinstance(state, ManagedState):
              raise TypeError("Not a managed state: %s" % repr(state))
          elif state.statemanager != self:
              raise ValueError("State %s is not associated with this state manager" % repr(state))
          if isinstance(label, tuple) and len(label) == 2:
              label = NameTitle(*label)
          self._add_state_internal(name, state.value, label=label,
              validator=validator, class_validator=class_validator, cache_for=cache_for)
docs: Add a conditional state that combines an existing state with a validator
          that must also pass. The validator receives the object on which the property
          is present as a parameter.
  
          :param str name: Name of the new state
          :param ManagedState state: Existing state that this is based on
          :param validator: Function that will be called with the host object as a parameter
          :param class_validator: Function that will be called when the state is queried
              on the class instead of the instance. Falls back to ``validator`` if not specified.
              Receives the class as the parameter
          :param cache_for: Integer or function that indicates how long ``validator``'s
              result can be cached (not applicable to ``class_validator``). ``None`` implies
              no cache, ``0`` implies indefinite cache (until invalidated by a transition)
              and any other integer is the number of seconds for which to cache the assertion
          :param label: Label for this state (string or 2-tuple)
  
          TODO: `cache_for`'s implementation is currently pending a test case demonstrating
          how it will be used.