'Create (boot) a new server.'

def _boot(self, resource_url, response_key, name, image, flavor, meta=None, files=None, userdata=None, reservation_id=False, return_raw=False, min_count=None, max_count=None, security_groups=None, key_name=None, availability_zone=None, block_device_mapping=None, block_device_mapping_v2=None, nics=None, scheduler_hints=None, config_drive=None, admin_pass=None, disk_config=None, access_ip_v4=None, access_ip_v6=None, description=None, tags=None, **kwargs):

    body = {'server': {'name': name, 'imageRef': (str(base.getid(image)) if image else ''), 'flavorRef': str(base.getid(flavor))}}
    if userdata:
        if hasattr(userdata, 'read'):
            userdata = userdata.read()
        if six.PY3:
            try:
                userdata = userdata.encode('utf-8')
            except AttributeError:
                pass
        else:
            try:
                userdata = encodeutils.safe_encode(userdata)
            except UnicodeDecodeError:
                pass
        userdata_b64 = base64.b64encode(userdata).decode('utf-8')
        body['server']['user_data'] = userdata_b64
    if meta:
        body['server']['metadata'] = meta
    if reservation_id:
        body['server']['return_reservation_id'] = reservation_id
        return_raw = True
    if key_name:
        body['server']['key_name'] = key_name
    if scheduler_hints:
        body['os:scheduler_hints'] = scheduler_hints
    if config_drive:
        body['server']['config_drive'] = config_drive
    if admin_pass:
        body['server']['adminPass'] = admin_pass
    if (not min_count):
        min_count = 1
    if (not max_count):
        max_count = min_count
    body['server']['min_count'] = min_count
    body['server']['max_count'] = max_count
    if security_groups:
        body['server']['security_groups'] = [{'name': sg} for sg in security_groups]
    if files:
        personality = body['server']['personality'] = []
        for (filepath, file_or_string) in sorted(files.items(), key=(lambda x: x[0])):
            if hasattr(file_or_string, 'read'):
                data = file_or_string.read()
            else:
                data = file_or_string
            if (six.PY3 and isinstance(data, str)):
                data = data.encode('utf-8')
            cont = base64.b64encode(data).decode('utf-8')
            personality.append({'path': filepath, 'contents': cont})
    if availability_zone:
        body['server']['availability_zone'] = availability_zone
    if block_device_mapping:
        body['server']['block_device_mapping'] = self._parse_block_device_mapping(block_device_mapping)
    elif block_device_mapping_v2:
        if image:
            bdm_dict = {'uuid': base.getid(image), 'source_type': 'image', 'destination_type': 'local', 'boot_index': 0, 'delete_on_termination': True}
            block_device_mapping_v2.insert(0, bdm_dict)
        body['server']['block_device_mapping_v2'] = block_device_mapping_v2
    if (nics is not None):
        if isinstance(nics, six.string_types):
            all_net_data = nics
        else:
            all_net_data = []
            for nic_info in nics:
                net_data = {}
                if nic_info.get('net-id'):
                    net_data['uuid'] = nic_info['net-id']
                if (nic_info.get('v4-fixed-ip') and nic_info.get('v6-fixed-ip')):
                    raise base.exceptions.CommandError(_("Only    one    of    'v4-fixed-ip'    and    'v6-fixed-ip'    may    be    provided."))
                elif nic_info.get('v4-fixed-ip'):
                    net_data['fixed_ip'] = nic_info['v4-fixed-ip']
                elif nic_info.get('v6-fixed-ip'):
                    net_data['fixed_ip'] = nic_info['v6-fixed-ip']
                if nic_info.get('port-id'):
                    net_data['port'] = nic_info['port-id']
                if nic_info.get('tag'):
                    net_data['tag'] = nic_info['tag']
                all_net_data.append(net_data)
        body['server']['networks'] = all_net_data
    if (disk_config is not None):
        body['server']['OS-DCF:diskConfig'] = disk_config
    if (access_ip_v4 is not None):
        body['server']['accessIPv4'] = access_ip_v4
    if (access_ip_v6 is not None):
        body['server']['accessIPv6'] = access_ip_v6
    if description:
        body['server']['description'] = description
    if tags:
        body['server']['tags'] = tags
    return self._create(resource_url, body, response_key, return_raw=return_raw, **kwargs)
