code: def validate_aggregation(agg):
      
      if agg is None:
          return agg
      supported_aggs = ['mean', 'sum', 'median', 'min', 'max', 'count']
      numpy_aggs = {getattr(np, a): a
                    for a in ['mean', 'sum', 'median', 'min', 'max']}
      builtin_aggs = {min: 'min', max: 'max', sum: 'sum'}
  
      agg = numpy_aggs.get(agg, agg)
      agg = builtin_aggs.get(agg, agg)
  
      if agg not in supported_aggs:
          raise ValueError("Unrecognized Vega-Lite aggregation: {0}".format(agg))
  
      return agg
docs: Validate an aggregation for use in Vega-Lite.
  
      Translate agg to one of the following supported named aggregations:
      ['mean', 'sum', 'median', 'min', 'max', 'count']
  
      Parameters
      ----------
      agg : string or callable
          A string
  
      Supported reductions are ['mean', 'sum', 'median', 'min', 'max', 'count'].
  
      If agg is a numpy function, the return value is the string representation.
  
      If agg is unrecognized, raise a ValueError