def METHOD_NAME(self):
    self.state_machine.insert_input = functools.partial(modified_insert_input, original=self.state_machine.insert_input)
    try:
        result = super().METHOD_NAME()
    finally:
        del self.state_machine.insert_input
    return result