def handler_func(x): if x > 0: return x * 2 return -x class Handler: def __init__(self): self.count = 0 def step(self): self.count += 1 return self.count