<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def groupby(iterable, key=None):
 """ Group items from iterable by key and return a dictionary where values are the lists of items from the iterable having the same key. :param key: function to apply to each element of the iterable. If not specified or is None key defaults to identity function and returns the element unchanged. :Example: {True: [0, 2], False: [1, 3]} """

    groups = {}
    for item in iterable:
        if key is None:
            key_value = item
        else:
            key_value = key(item)
        groups.setdefault(key_value, []).append(item)
    return groups