docs: def create(cls, datacenter, memory, cores, ip_version, bandwidth,
                 login, password, hostname, image, run, background, sshkey,
                 size, vlan, ip, script, script_args, ssh):
          """Create a new virtual machine."""
          from gandi.cli.modules.network import Ip, Iface
          if not background and not cls.intty():
              background = True
  
          datacenter_id_ = int(Datacenter.usable_id(datacenter))
  
          if not hostname:
              hostname = randomstring('vm')
              disk_name = 'sys_%s' % hostname[2:]
          else:
              disk_name = 'sys_%s' % hostname.replace('.', '')
  
          vm_params = {
              'hostname': hostname,
              'datacenter_id': datacenter_id_,
              'memory': memory,
              'cores': cores,
          }
  
          if login:
              vm_params['login'] = login
  
          if run:
              vm_params['run'] = run
  
          if password:
              vm_params['password'] = password
  
          if ip_version:
              vm_params['ip_version'] = ip_version
              vm_params['bandwidth'] = bandwidth
  
          if script:
              with open(script) as fd:
                  vm_params['script'] = fd.read()
              if script_args:
                  vm_params['script_args'] = script_args
  
          vm_params.update(cls.convert_sshkey(sshkey))
  
          # XXX: name of disk is limited to 15 chars in ext2fs, ext3fs
          # but api allow 255, so we limit to 15 for now
          disk_params = {'datacenter_id': vm_params['datacenter_id'],
                         'name': disk_name[:15]}
  
          if size:
              if isinstance(size, tuple):
                  prefix, size = size
              disk_params['size'] = size
  
          sys_disk_id_ = int(Image.usable_id(image, datacenter_id_))
  
          ip_summary = []
          if ip_version == 4:
              ip_summary = ['v4', 'v6']
          elif ip_version == 6:
              ip_summary = ['v6']
  
          if vlan:
              ip_ = None
              ip_summary.append('private')
              if ip:
                  try:
                      ip_ = Ip.info(ip)
                  except Exception:
                      pass
                  else:
                      if not Ip._check_and_detach(ip_, None):
                          return
              if ip_:
                  iface_id = ip_['iface_id']
              else:
                  ip_create = Ip.create(4,
                                        vm_params['datacenter_id'],
                                        bandwidth,
                                        None,
                                        vlan,
                                        ip)
  
                  iface_id = ip_create['iface_id']
  
              # if there is a public ip, will attach this one later, else give
              # the iface to vm.create
              if not ip_version:
                  vm_params['iface_id'] = iface_id
  
          result = cls.call('hosting.vm.create_from', vm_params, disk_params,
                            sys_disk_id_)
  
          cls.echo('* Configuration used: %d cores, %dMb memory, ip %s, '
                   'image %s, hostname: %s, datacenter: %s' %
                   (cores, memory, '+'.join(ip_summary), image, hostname,
                    datacenter))
  
          # background mode, bail out now (skip interactive part)
          if background and (not vlan or not ip_version):
              return result
  
          # interactive mode, run a progress bar
          cls.echo('Creating your Virtual Machine %s.' % hostname)
          cls.display_progress(result)
          cls.echo('Your Virtual Machine %s has been created.' % hostname)
  
          vm_id = None
          for oper in result:
              if oper.get('vm_id'):
                  vm_id = oper.get('vm_id')
                  break
  
          if vlan and ip_version:
              attach = Iface._attach(iface_id, vm_id)
              if background:
                  return attach
  
          if 'ssh_key' not in vm_params and 'keys' not in vm_params:
              return
  
          if vm_id and ip_version:
              cls.wait_for_sshd(vm_id)
              if ssh:
                  cls.ssh_keyscan(vm_id)
                  cls.ssh(vm_id, 'root', None)