def eval_stats(values, mode):
    '''Extract a summary statistic from an array of list of values

    Parameters:
        values: numpy array of values
        mode: summary stat to extract. One of ['min', 'max', 'median', 'mean', 'std', 'raw']

    Note: fails silently if values is empty, and None is returned
    '''
    if mode == 'raw':
        return values.tolist()
    if mode == 'total':
        mode = 'sum'

    try:
        return getattr(np, mode)(values, axis=0)
    except ValueError:
        pass

    return None
Extract a summary statistic from an array of list of values

    Parameters:
        values: numpy array of values
        mode: summary stat to extract. One of ['min', 'max', 'median', 'mean', 'std', 'raw']

    Note: fails silently if values is empty, and None is returned