def mk_metric(m):
    "Convert `m` to an `AvgMetric`, unless it's already a `Metric`"
    return (m if isinstance(m, Metric) else AvgMetric(m))
Convert `m` to an `AvgMetric`, unless it's already a `Metric`
def mk_metric(m):
    
    return (m if isinstance(m, Metric) else AvgMetric(m))