design pattern quick reference def poll_for_change(self)if self changedself update_all def update_all(self)for callback in self callbackscallback(selfstate state py class state(object)pass class concretestate (state)def __init__(selfstate_machine)self state_machine state_machine def switch_state(self)self state_machine state self state_machine state class concretestate (state)def __init__(selfstate_machine)self state_machine state_machine def switch_state(self)self state_machine state self state_machine state class statemachine(object)def __init__(self)self state concretestate (selfself state concretestate (selfself state self state def switch(self)self state switch_state(