docs: def main(name, options):
      """The main method for this script.
  
      :param name: The name of the VM to create.
      :type name: str
      :param template_name: The name of the template to use for creating \
              the VM.
      :type template_name: str
  
      """
      server = config._config_value("general", "server", options.server)
      if server is None:
          raise ValueError("server must be supplied on command line"
                           " or in configuration file.")
      username = config._config_value("general", "username", options.username)
      if username is None:
          raise ValueError("username must be supplied on command line"
                           " or in configuration file.")
      password = config._config_value("general", "password", options.password)
      if password is None:
          raise ValueError("password must be supplied on command line"
                           " or in configuration file.")
  
      vm_template = None
      if options.template is not None:
          try:
              vm_template = template.load_template(options.template)
          except TemplateNotFoundError:
              print("ERROR: Template \"%s\" could not be found." % options.template)
              sys.exit(1)
  
      expected_opts = ["compute_resource", "datastore", "disksize", "nics",
                       "memory", "num_cpus", "guest_id", "host"]
  
      vm_opts = {}
      for opt in expected_opts:
          vm_opts[opt] = getattr(options, opt)
          if vm_opts[opt] is None:
              if vm_template is None:
                  raise ValueError("%s not specified on the command line and"
                                   " you have not specified any template to"
                                   " inherit the value from." % opt)
              try:
                  vm_opts[opt] = vm_template[opt]
              except AttributeError:
                  raise ValueError("%s not specified on the command line and"
                                   " no value is provided in the specified"
                                   " template." % opt)
  
      client = Client(server=server, username=username, password=password)
      create_vm(client, name, vm_opts["compute_resource"], vm_opts["datastore"],
                vm_opts["disksize"], vm_opts["nics"], vm_opts["memory"],
                vm_opts["num_cpus"], vm_opts["guest_id"], host=vm_opts["host"])
      client.logout()