Transducers in Python