nodes: 0, module; 1, function_definition; 2, function_name:group_objects_by; 3, parameters; 4, block; 5, identifier:self; 6, identifier:list; 7, identifier:attr; 8, default_parameter; 9, default_parameter; 10, expression_statement; 11, expression_statement; 12, for_statement; 13, return_statement; 14, identifier:valueLabel; 15, string:"value"; 16, identifier:childrenLabel; 17, string:"children"; 18, comment:"""
          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
          """; 19, assignment; 20, identifier:obj; 21, identifier:list; 22, block; 23, identifier:groups; 24, identifier:groups; 25, list; 26, expression_statement; 27, if_statement; 28, expression_statement; 29, expression_statement; 30, for_statement; 31, if_statement; 32, assignment; 33, not_operator; 34, block; 35, assignment; 36, assignment; 37, identifier:i; 38, call; 39, block; 40, not_operator; 41, block; 42, identifier:val; 43, call; 44, identifier:val; 45, pass_statement; 46, identifier:newGroup; 47, dictionary; 48, identifier:found; 49, False; 50, identifier:range; 51, argument_list; 52, if_statement; 53, identifier:found; 54, expression_statement; 55, attribute; 56, argument_list; 57, pair; 58, pair; 59, pair; 60, integer:0; 61, call; 62, comparison_operator:val == groups[i].get(valueLabel); 63, block; 64, call; 65, identifier:obj; 66, identifier:get; 67, identifier:attr; 68, string:"attribute"; 69, identifier:attr; 70, identifier:valueLabel; 71, identifier:val; 72, identifier:childrenLabel; 73, list; 74, identifier:len; 75, argument_list; 76, identifier:val; 77, call; 78, expression_statement; 79, expression_statement; 80, pass_statement; 81, attribute; 82, argument_list; 83, identifier:obj; 84, identifier:groups; 85, attribute; 86, argument_list; 87, assignment; 88, call; 89, identifier:groups; 90, identifier:append; 91, identifier:newGroup; 92, subscript; 93, identifier:get; 94, identifier:valueLabel; 95, identifier:found; 96, True; 97, attribute; 98, argument_list; 99, identifier:groups; 100, identifier:i; 101, subscript; 102, identifier:append; 103, identifier:obj; 104, subscript; 105, identifier:childrenLabel; 106, identifier:groups; 107, identifier:i
code: def group_objects_by(self, list, attr, valueLabel="value", childrenLabel="children"):
          """
          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
          """
  
          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