Split a collection by using a factor

    :param coll: a collection
    :param factor: a collection of factors
    :returns: a dictionary

    >>> bands = ('Led Zeppelin', 'Debussy', 'Metallica', 'Iron Maiden', 'Bach')
    >>> styles = ('rock', 'classic', 'rock', 'rock', 'classic')
    >>> split(bands, styles)
    {'classic': ['Debussy', 'Bach'], 'rock': ['Led Zeppelin', 'Metallica', 'Iron Maiden']}

def split(coll, factor):
    """Split a collection by using a factor

    :param coll: a collection
    :param factor: a collection of factors
    :returns: a dictionary

    >>> bands = ('Led Zeppelin', 'Debussy', 'Metallica', 'Iron Maiden', 'Bach')
    >>> styles = ('rock', 'classic', 'rock', 'rock', 'classic')
    >>> split(bands, styles)
    {'classic': ['Debussy', 'Bach'], 'rock': ['Led Zeppelin', 'Metallica', 'Iron Maiden']}

    """
    groups = groupby(lambda x: x[0], itertools.izip(factor, coll))
    return dmap(lambda x: [y[1] for y in x], groups)