docs: def by_organizations(self, field=None):
          """
          Used to seggregate the data acording to organizations. This method
          pops the latest aggregation from the self.aggregations dict and
          adds it as a nested aggregation under itself
  
          :param field: the field to create the parent agg (optional)
                        default: author_org_name
          :returns: self, which allows the method to be chainable with the other methods
          """
  
          # this functions is currently only for issues and PRs
          agg_field = field if field else "author_org_name"
          agg_key = "terms_" + agg_field
          if agg_key in self.aggregations.keys():
              agg = self.aggregations[agg_key]
          else:
              agg = A("terms", field=agg_field, missing="others", size=self.size)
  
          child_agg_counter = self.child_agg_counter_dict[agg_key]  # 0 if not present because defaultdict
          child_name, child_agg = self.aggregations.popitem()
  
          agg.metric(child_agg_counter, child_agg)
          self.aggregations[agg_key] = agg
          self.child_agg_counter_dict[agg_key] += 1
          return self