code: def prompt_choice_list(msg, a_list, default=1, help_string=None):
      
      verify_is_a_tty()
      options = '\n'.join([' [{}] {}{}'
                           .format(i + 1,
                                   x['name'] if isinstance(x, dict) and 'name' in x else x,
                                   ' - ' + x['desc'] if isinstance(x, dict) and 'desc' in x else '')
                           for i, x in enumerate(a_list)])
      allowed_vals = list(range(1, len(a_list) + 1))
      while True:
          val = _input('{}\n{}\nPlease enter a choice [Default choice({})]: '.format(msg, options, default))
          if val == '?' and help_string is not None:
              print(help_string)
              continue
          if not val:
              val = '{}'.format(default)
          try:
              ans = int(val)
              if ans in allowed_vals:
                  # array index is 0-based, user input is 1-based
                  return ans - 1
              raise ValueError
          except ValueError:
              logger.warning('Valid values are %s', allowed_vals)
docs: Prompt user to select from a list of possible choices.
  
      :param msg:A message displayed to the user before the choice list
      :type msg: str
      :param a_list:The list of choices (list of strings or list of dicts with 'name' & 'desc')
      "type a_list: list
      :param default:The default option that should be chosen if user doesn't enter a choice
      :type default: int
      :returns: The list index of the item chosen.