from functools import reduce
from typing import OrderedDict


def create_dict(l):
    """
    given a list of set of type [(k1,v1),..,(kn,vn)]
    generates a dict where keys are k's and values are [v's]
    e.g.,

    >>> d = create_dict([('a',1),['b',2],('a',3),('c',4),('b',10)]); d
    OrderedDict([('a', [1, 3]), ('b', [2, 10]), ('c', [4])])
    >>> d['x']
    Traceback (most recent call last):
    ...
    KeyError: 'x'
    """
    return reduce(lambda d,kv:d.setdefault(kv[0],[]).append(kv[1]) or d,l,OrderedDict())