docs: def _monthly_operation(self, operation, percentile=0):
          """Get a MonthlyCollection given a certain operation."""
          # Retrive the correct operation.
          if operation == 'average':
              funct = self._average
          elif operation == 'total':
              funct = self._total
          else:
              assert 0 <= percentile <= 100, \
                  'percentile must be between 0 and 100. Got {}'.format(percentile)
              funct = self._get_percentile_function(percentile)
  
          # Get the data for the new collection
          data_dict = self.group_by_month()
          new_data, d_times = [], []
          for i in self.header.analysis_period.months_int:
              vals = data_dict[i]
              if vals != []:
                  new_data.append(funct(vals))
                  d_times.append(i)
  
          # build the new monthly collection
          new_header = self.header.duplicate()
          if operation == 'percentile':
              new_header.metadata['operation'] = '{} percentile'.format(percentile)
          else:
              new_header.metadata['operation'] = operation
          collection = MonthlyCollection(new_header, new_data, d_times)
          collection._validated_a_period = True
          return collection