def extract_ints(text):
    for line in text.split('\n'):
        fields = line.split(':')
yield fields[0], fields[1]

def my_consumer_function(text):
    it1, it2 = tee(extract_ints(text))
it1 = double_ints(map(itemgetter(0), it1))
it2 = map(itemgetter(1), it2)
for value, sign in zip(it1, it2):
    if sign == '-':
        value *= -1
print(value)
How to send extra results from a python generator to a consumer function?