'Initialize & add a `state_class` (`State` subclass) object.
Exception: `DuplicateStateError` raised if `state_class` was already
added.'

def add_state(self, state_class):

    statename = state_class.__name__
    if self.states.has_key(statename):
        raise DuplicateStateError(statename)
    self.states[statename] = state_class(self, self.debug)
