code: def options_from_form(self, formdata):
          
          if not self.profile_list or self._profile_list is None:
              return formdata
          # Default to first profile if somehow none is provided
          try:
              selected_profile = int(formdata.get('profile', [0])[0])
              options = self._profile_list[selected_profile]
          except (TypeError, IndexError, ValueError):
              raise web.HTTPError(400, "No such profile: %i", formdata.get('profile', None))
          return {
              'profile': options['display_name']
          }
docs: get the option selected by the user on the form
  
          This only constructs the user_options dict,
          it should not actually load any options.
          That is done later in `.load_user_options()`
  
          Args:
              formdata: user selection returned by the form
  
          To access to the value, you can use the `get` accessor and the name of the html element,
          for example::
  
              formdata.get('profile',[0])
  
          to get the value of the form named "profile", as defined in `form_template`::
  
              <select class="form-control" name="profile"...>
              </select>
  
          Returns:
              user_options (dict): the selected profile in the user_options form,
                  e.g. ``{"profile": "8 CPUs"}``