def group(seq):
    '''seq is a sequence of tuple containing (item_to_be_categorized, category)'''
    result = {}
    for item, category in seq:
        result.setdefault(category, []).append(item)
    return result
seq is a sequence of tuple containing (item_to_be_categorized, category)
recipes/Python/498223_group_and_partition/recipe-498223.py