'Compute various stats from a list of values.'

def _gen_stats(self, stats, name=None):

    cstats = [x for x in stats if (x is not None)]
    if (len(cstats) > 0):
        ret_dict = {'low': min(cstats), 'high': max(cstats), 'total': sum(cstats), 'reported': len(cstats), 'number_none': (len(stats) - len(cstats)), 'name': name}
        ret_dict['average'] = (ret_dict['total'] / float(len(cstats)))
        ret_dict['perc_none'] = ((ret_dict['number_none'] * 100.0) / len(stats))
    else:
        ret_dict = {'reported': 0}
    return ret_dict
