code: def old_roles_manager(self):
          '''Return old roles, grouped first by term, then by chamber,
          then by type.'''
          wrapper = self._old_role_wrapper
          chamber_getter = operator.methodcaller('get', 'chamber')
          for term, roles in self.get('old_roles', {}).items():
              chamber_roles = defaultdict(lambda: defaultdict(list))
              for chamber, roles in itertools.groupby(roles, chamber_getter):
                  for role in roles:
                      role = wrapper(role)
                      typeslug = role['type'].lower().replace(' ', '_')
                      chamber_roles[chamber][typeslug].append(role)
              yield term, chamber_rolef old_roles_manager(self):
          '''Return old roles, grouped first by term, then by chamber,
          then by type.'''
          wrapper = self._old_role_wrapper
          chamber_getter = operator.methodcaller('get', 'chamber')
          for term, roles in self.get('old_roles', {}).items():
              chamber_roles = defaultdict(lambda: defaultdict(list))
              for chamber, roles in itertools.groupby(roles, chamber_getter):
                  for role in roles:
                      role = wrapper(role)
                      typeslug = role['type'].lower().replace(' ', '_')
                      chamber_roles[chamber][typeslug].append(role)
              yield term, chamber_roles
docs: Return old roles, grouped first by term, then by chamber,
          then by type.