def output_image(gandi, image, datacenters, output_keys, justify=14,
                 warn_deprecated=True):
    """ Helper to output a disk image."""

    for key in output_keys:
        if key in image:
            if (key == 'label' and image['visibility'] == 'deprecated' and
                    warn_deprecated):
                image[key] = '%s /!\ DEPRECATED' % image[key]
            output_line(gandi, key, image[key], justify)

    dc_name = 'Nowhere'

    if 'dc' in output_keys:
        for dc in datacenters:
            if dc['id'] == image['datacenter_id']:
                dc_name = dc.get('dc_code', dc.get('iso', ''))

                break

        output_line(gandi, 'datacenter', dc_name, justify)
Helper to output a disk image.