human
Complete this python program:
def fake_disk_info_byname(instance, type='qcow2'):
assistant
#Here is the Python program you requested.

    """Return instance_disk_info corresponding accurately to the properties of
    the given Instance object. The info is returned as an OrderedDict of
    name->disk_info for each disk.
    :param instance: The instance we\re generating fake disk_info for.
    :param type: libvirt\s disk type.
    :return: disk_info
    :rtype: OrderedDict
    """
    instance_dir = os.path.join(CONF.instances_path, instance.uuid)
    def instance_path(name):
        return os.path.join(instance_dir, name)
    disk_info = OrderedDict()
    if ((instance.image_ref is not None) and (instance.image_ref != uuids.fake_volume_backed_image_ref)):
        cache_name = imagecache.get_cache_fname(instance.image_ref)
        disk_info['disk'] = {'type': type, 'path': instance_path('disk'), 'virt_disk_size': (instance.flavor.root_gb * units.Gi), 'backing_file': cache_name, 'disk_size': (instance.flavor.root_gb * units.Gi), 'over_committed_disk_size': 0}
    swap_mb = instance.flavor.swap
    if (swap_mb > 0):
        disk_info['disk.swap'] = {'type': type, 'path': instance_path('disk.swap'), 'virt_disk_size': (swap_mb * units.Mi), 'backing_file': ('swap_%s' % swap_mb), 'disk_size': (swap_mb * units.Mi), 'over_committed_disk_size': 0}
    eph_gb = instance.flavor.ephemeral_gb
    if (eph_gb > 0):
        disk_info['disk.local'] = {'type': type, 'path': instance_path('disk.local'), 'virt_disk_size': (eph_gb * units.Gi), 'backing_file': eph_name(eph_gb), 'disk_size': (eph_gb * units.Gi), 'over_committed_disk_size': 0}
    if instance.config_drive:
        disk_info['disk.config'] = {'type': 'raw', 'path': instance_path('disk.config'), 'virt_disk_size': 1024, 'backing_file': '', 'disk_size': 1024, 'over_committed_disk_size': 0}
    return disk_info