= lambda chunk: pair_sums.append(sum(chunk))
    >>> list(side_effect(func, [0, 1, 2, 3, 4, 5], 2))
    [0, 1, 2, 3, 4, 5]
    >>> list(pair_sums)
    [1, 5, 9]

Writing to a file-like object:

    >>> from io import StringIO
    >>> from more_itertools import consume
    >>> f = StringIO()
    >>> func = lambda x: print(x, file=f)
    >>> before = lambda: print(u'HEADER', file=f)
    >>> after = f.close
    >>> it = [u'a', u'b', u'c']
    >>> consume(side_effect(func, it, before=before, after=after))
    >>> f.closed
    True

N)