Construct server instance from cloud profile config

def _get_server(vm_):
    '''
    Construct server instance from cloud profile config
    '''
    description = config.get_cloud_config_value(
        'description', vm_, __opts__, default=None,
        search_global=False
    )

    ssh_key = load_public_key(vm_)

    server_type = config.get_cloud_config_value(
        'server_type', vm_, __opts__, default='cloud',
        search_global=False
    )
    vcore = None
    cores_per_processor = None
    ram = None
    fixed_instance_size_id = None
    baremetal_model_id = None

    if 'fixed_instance_size' in vm_:
        fixed_instance_size = get_size(vm_)
        fixed_instance_size_id = fixed_instance_size['id']
    elif 'vm_core' in vm_ and 'cores_per_processor' in vm_ and 'ram' in vm_ and 'hdds' in vm_:
        vcore = config.get_cloud_config_value(
            'vcore', vm_, __opts__, default=None,
            search_global=False
        )
        cores_per_processor = config.get_cloud_config_value(
            'cores_per_processor', vm_, __opts__, default=None,
            search_global=False
        )
        ram = config.get_cloud_config_value(
            'ram', vm_, __opts__, default=None,
            search_global=False
        )
    elif 'baremetal_model_id' in vm_ and server_type == 'baremetal':
        baremetal_model_id = config.get_cloud_config_value(
            'baremetal_model_id', vm_, __opts__, default=None,
            search_global=False
        )
    else:
        raise SaltCloudConfigError("'fixed_instance_size' or 'vcore', "
                                   "'cores_per_processor', 'ram', and 'hdds' "
                                   "must be provided for 'cloud' server. "
                                   "For 'baremetal' server, 'baremetal_model_id'"
                                   "must be provided.")

    appliance_id = config.get_cloud_config_value(
        'appliance_id', vm_, __opts__, default=None,
        search_global=False
    )

    password = config.get_cloud_config_value(
        'password', vm_, __opts__, default=None,
        search_global=False
    )

    firewall_policy_id = config.get_cloud_config_value(
        'firewall_policy_id', vm_, __opts__, default=None,
        search_global=False
    )

    ip_id = config.get_cloud_config_value(
        'ip_id', vm_, __opts__, default=None,
        search_global=False
    )

    load_balancer_id = config.get_cloud_config_value(
        'load_balancer_id', vm_, __opts__, default=None,
        search_global=False
    )

    monitoring_policy_id = config.get_cloud_config_value(
        'monitoring_policy_id', vm_, __opts__, default=None,
        search_global=False
    )

    datacenter_id = config.get_cloud_config_value(
        'datacenter_id', vm_, __opts__, default=None,
        search_global=False
    )

    private_network_id = config.get_cloud_config_value(
        'private_network_id', vm_, __opts__, default=None,
        search_global=False
    )

    power_on = config.get_cloud_config_value(
        'power_on', vm_, __opts__, default=True,
        search_global=False
    )

    public_key = config.get_cloud_config_value(
        'public_key_ids', vm_, __opts__, default=None,
        search_global=False
    )

    # Contruct server object
    return Server(
        name=vm_['name'],
        description=description,
        fixed_instance_size_id=fixed_instance_size_id,
        vcore=vcore,
        cores_per_processor=cores_per_processor,
        ram=ram,
        appliance_id=appliance_id,
        password=password,
        power_on=power_on,
        firewall_policy_id=firewall_policy_id,
        ip_id=ip_id,
        load_balancer_id=load_balancer_id,
        monitoring_policy_id=monitoring_policy_id,
        datacenter_id=datacenter_id,
        rsa_key=ssh_key,
        private_network_id=private_network_id,
        public_key=public_key,
        server_type=server_type,
        baremetal_model_id=baremetal_model_id
    )