code: def choose(name, choices, default=None, resolve=None, no_choice=('none',)):
      
  
      if not resolve:
          resolve = lambda o: o.lower()
  
      _choices = []
      options = []
  
      for choice in choices:
          if isinstance(choice, string_type):
              options.append(choice)
          else:
              options.append("%s [%s]" % (choice[1], choice[0]))
              choice = choice[0]
          _choices.append(choice)
  
      while True:
          rv = prompt(name + '? - (%s)' % ', '.join(options), default)
          if not rv:
              return default
          rv = resolve(rv)
          if rv in no_choice:
              return None
          if rv in _choices:
              return rv
docs: Grabs user input from command line from set of provided choices.
  
      :param name: prompt text
      :param choices: list or tuple of available choices. Choices may be
                      single strings or (key, value) tuples.
      :param default: default value if no input provided.
      :param no_choice: acceptable list of strings for "null choice"