code: def group_objects_by(self, list, attr, valueLabel="value", childrenLabel="children"):
          groups = []
          for obj in list:
              val = obj.get(attr)
              if not val:
                  pass
              newGroup = {"attribute": attr, valueLabel: val, childrenLabel: [obj]}
              found = False
              for i in range(0,len(groups)):
                  if val == groups[i].get(valueLabel):
                      found = True
                      groups[i][childrenLabel].append(obj)
                      pass
              if not found:
                  groups.append(newGroup)
          return groups