def _entities_years_list_to_dict(l):
    """
    Create a dict of entites by year
    :param l: list which each element is a size two tuple (year, entity_id
    :return: a dict in which each key is a year and each value is a list of entities
    :rtype: dict<int,list>
    """
    d = {}
    for y, eid in l:
        y = str(y)  # for easier mongo insert key need to be str
        if y not in d:
            d[y] = []
        d[y].append(eid)
    return d