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
docs: Generates a group object based on the attribute value on of the given attr value that is passed in.
  
          :param list list: A list of dictionary objects
          :param str attr: The attribute that the dictionaries should be sorted upon
          :param str valueLabel: What to call the key of the field we're sorting upon
          :param str childrenLabel: What to call the list of child objects on the group object
          :returns: list of grouped objects by a given attribute
          :rtype: list