def get_server_details_dict(app, req, instance, is_list):

    image_id = utils.lookup(instance,
                            'blockDeviceTemplateGroup',
                            'globalIdentifier')
    tenant_id = str(instance['accountId'])

    client = req.env['sl_client']
    vs = client['Virtual_Guest']

    flavor_url = None
    flavor_id = 1

    if is_list:
        tags = vs.getTagReferences(id=instance['id'])
        for tag in tags:
            if 'flavor_id' in tag['tag']['name']:
                try:
                    # Try to parse the flavor id from the tag format
                    # i.e. 'flavor_id: 2'
                    tag_string = tag['tag']['name']

                    flavor_id = int(re.search(r'\d+', tag_string).group())
                    flavor_url = app.get_endpoint_url(
                        'compute', req, 'v2_flavor', flavor_id=flavor_id)
                except Exception:
                    pass

    # Workaround of hardcoded ID for VS's created before flavor-id
    # pushed into tags
    if not flavor_url:
        flavor_url = app.get_endpoint_url(
            'compute', req, 'v2_flavor', flavor_id=1)

    server_url = app.get_endpoint_url(
        'compute', req, 'v2_server', server_id=instance['id'])

    task_state = None
    transaction = utils.lookup(instance,
                               'activeTransaction',
                               'transactionStatus',
                               'name')

    if transaction and any([transaction in 'RECLAIM',
                            'TEAR_DOWN' in transaction]):
        task_state = 'deleting'
    else:
        task_state = transaction

    # Map SL Power States to OpenStack Power States
    power_state = 0
    status = 'UNKNOWN'

    sl_power_state = instance['powerState']['keyName']
    if sl_power_state == 'RUNNING':
        if transaction or not instance.get('provisionDate'):
            status = 'BUILD'
            power_state = OPENSTACK_POWER_MAP['BLOCKED']
        else:
            status = 'ACTIVE'
            power_state = OPENSTACK_POWER_MAP['RUNNING']
    elif sl_power_state == 'PAUSED':
        status = 'PAUSED'
        power_state = OPENSTACK_POWER_MAP['PAUSED']
    elif sl_power_state in OPENSTACK_POWER_MAP:
        power_state = OPENSTACK_POWER_MAP[sl_power_state]
    elif sl_power_state == 'HALTED' and instance.get('provisionDate'):
        status = 'SHUTOFF'
        power_state = OPENSTACK_POWER_MAP['SHUTOFF']
    elif sl_power_state == 'HALTED':
        status = 'SHUTOFF'
        power_state = OPENSTACK_POWER_MAP['BLOCKED']

    addresses = {}
    if instance.get('primaryBackendIpAddress'):
        addresses['private'] = [{
            'addr': instance.get('primaryBackendIpAddress'),
            'version': 4,
            'OS-EXT-IPS:type': 'fixed',
        }]

    if instance.get('primaryIpAddress'):
        addresses['public'] = [{
            'addr': instance.get('primaryIpAddress'),
            'version': 4,
            'OS-EXT-IPS:type': 'fixed',
        }]

    # TODO(kmcdonald) - Don't hardcode this
    image_name = ''
    # returning None makes tempest fail,
    # conditionally returning empty string for uid and zone
    uid = str(utils.lookup(instance,
                           'billingItem',
                           'orderItem',
                           'order',
                           'userRecordId'))
    if not uid:
        uid = ''
    zone = str(utils.lookup(instance,
                            'datacenter',
                            'id'))
    if not zone:
        zone = ''

    results = {
        'id': str(instance['id']),
        'accessIPv4': '',
        'accessIPv6': '',
        'addresses': addresses,
        'created': instance['createDate'],
        # TODO(nbeitenmiller) - Do I need to run this through isoformat()?
        'flavor': {
            'id': str(flavor_id),
            'links': [
                {
                    'href': flavor_url,
                    'rel': 'bookmark',
                },
            ],
        },
        'hostId': str(instance['id']),
        'links': [
            {
                'href': server_url,
                'rel': 'self',
            }
        ],
        'name': instance['hostname'],
        'OS-EXT-AZ:availability_zone': zone,
        'OS-EXT-STS:power_state': power_state,
        'OS-EXT-STS:task_state': task_state,
        'OS-EXT-STS:vm_state': instance['status']['keyName'],
        'security_groups': [{'name': 'default'}],
        'status': status,
        'tenant_id': tenant_id,
        # NOTE(bodenr): userRecordId accessibility determined by permissions
        # of API caller's user id and api key. Otherwise it will be None
        'user_id': uid,
        'updated': instance['modifyDate'],
        'image_name': image_name,
        # TODO(imkarrer) added to make tempest pass, need real metadata
        'metadata': {}
    }

    # OpenStack only supports having one SSH Key assigned to an instance
    if instance['sshKeys']:
        results['key_name'] = instance['sshKeys'][0]['label']

    if image_id:
        results['image'] = {
            'id': image_id,
            'links': [
                {
                    'href': app.get_endpoint_url(
                        'compute', req, 'v2_image', image_id=image_id),
                    'rel': 'self',
                },
            ],
        }

    return results
dataset/ETHPy150Open softlayer/jumpgate/jumpgate/compute/drivers/sl/servers.py/get_server_details_dict/swapped operands of `in`