def many2many_dicts(m2mlist):
    """
    Maps objects from one list to the other list and vice versa.

    Args:
        m2mlist: list of 2lists [list1i, list2i] where list1i, list2i represent
        a many to many mapping
    Returns:
        (one2two, two2one) : one2two, two2one
        dictionaries from elements of list1i to list2i and vice versa
    """
    one2two = {}
    two2one = {}
    for one, two in m2mlist:
        for k in one:
            one2two[k] = two
            for k in two:
                two2one[k] = one
    return (one2two, two2one)