code: def build_groups(self):
          
          # check if there are any groupings
          if len(self.groups):
              groups = []
  
              # get the group sql for each grouping
              for group in self.groups:
                  groups.append(group.get_name())
              return 'GROUP BY {0} '.format(', '.join(groups))
          return ''
docs: Generates the sql for the GROUP BY portion of the query
  
          :return: the GROUP BY portion of the query
          :rtype: str