def _mlag_bonds(self, key='name'):
    mlag_bonds = self.mlag_bonds
    x = {}
    for (rack, bonds) in mlag_bonds.items():
        _groupby = {}
        for (k, v) in itertools.groupby(bonds, (lambda x: x[key])):
            for item in list(v):
                _groupby[k] = item
        x[rack] = _groupby
    return x
def _mlag_bonds(self, key='name'):
    mlag_bonds = self.mlag_bonds
    x = {}
    for (rack, bonds) in mlag_bonds.items():
        _groupby = {}
        for (k, v) in itertools.groupby(bonds, (lambda x: x[key])):
            for item in list(v):
                _groupby[k] = item
        x[rack] = _groupby
    return x