def _get_flavor_image_meta(key, flavor, image_meta, default=None):
    """Extract both flavor- and image-based variants of metadata."""
    flavor_key = ':'.join(['hw', key])
    image_key = '_'.join(['hw', key])
    flavor_policy = flavor.get('extra_specs', {}).get(flavor_key, default)
    image_policy = image_meta.properties.get(image_key, default)
    return flavor_policy, image_policy
