<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def group_by(function):
 """ Groups input sequence by `function`. Returns an iterator over a sequence of tuples where the first item is a result of `function` and the second one a list of items matching this result. Ordering of the resulting iterator is undefined, but ordering of the items in the groups is preserved. [(0, [2, 4, 6]), (1, [1, 3, 5])] """

    def _group_by(seq):
        result = {}
        for item in seq:
            result.setdefault(function(item), []).append(item)
        return dict_items(result)

    return _group_by