def output_metric(gandi, metrics, key, justify=10):
    """ Helper to output metrics."""
    for metric in metrics:
        key_name = metric[key].pop()
        values = [point.get('value', 0) for point in metric['points']]
        graph = sparks(values) if max(values) else ''
        # need to encode in utf-8 to work in python2.X
        if sys.version_info < (2, 8):
            graph = graph.encode('utf-8')
        output_line(gandi, key_name, graph, justify)
Helper to output metrics.