def validate_aggregation(agg):
if agg is None:<EOL><INDENT>return agg<EOL><DEDENT>supported_aggs = ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT:count>']<EOL>numpy_aggs = {getattr(np, a): a<EOL>for a in ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>']}<EOL>builtin_aggs = {min: '<STR_LIT>', max: '<STR_LIT>', sum: '<STR_LIT>'}<EOL>agg = numpy_aggs.get(agg, agg)<EOL>agg = builtin_aggs.get(agg, agg)<EOL>if agg not in supported_aggs:<EOL><INDENT>raise ValueError("<STR_LIT>".format(agg))<EOL><DEDENT>return agg<EOL>
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