def state_push(self):
        "Save the state of the output functions, to be restored with state_pop."
        for of in self.output_fns:
            if hasattr(of,'state_push'):
                of.state_push()
        super(PatternGenerator, self).state_push()