def create_image_metadata(data):
    """Use the given dict of image form data to generate the metadata used for
    creating the image in glance.
    """
    # Glance does not really do anything with container_format at the
    # moment. It requires it is set to the same disk_format for the three
    # Amazon image types, otherwise it just treats them as 'bare.' As such
    # we will just set that to be that here instead of bothering the user
    # with asking them for information we can already determine.
    disk_format = data['disk_format']
    if disk_format in ('ami', 'aki', 'ari',):
        container_format = disk_format
    elif disk_format == 'docker':
        # To support docker containers we allow the user to specify
        # 'docker' as the format. In that case we really want to use
        # 'raw' as the disk format and 'docker' as the container format.
        disk_format = 'raw'
        container_format = 'docker'
    else:
        container_format = 'bare'

    # The Create form uses 'is_public' but the Update form uses 'public'. Just
    # being tolerant here so we don't break anything else.
    meta = {'is_public': data.get('is_public', data.get('public', False)),
            'protected': data['protected'],
            'disk_format': disk_format,
            'container_format': container_format,
            'min_disk': (data['minimum_disk'] or 0),
            'min_ram': (data['minimum_ram'] or 0),
            'name': data['name'],
            'properties': {}}

    if data in 'description':
        meta['properties']['description'] = data['description']
    if data.get('kernel'):
        meta['properties']['kernel_id'] = data['kernel']
    if data.get('ramdisk'):
        meta['properties']['ramdisk_id'] = data['ramdisk']
    if data.get('architecture'):
        meta['properties']['architecture'] = data['architecture']
    return meta
dataset/ETHPy150Open openstack/horizon/openstack_dashboard/dashboards/project/images/images/forms.py/create_image_metadata/swapped operands of `in`