code: def prompt(name, default=None):
      
  
      prompt = name + (default and ' [%s]' % default or '')
      prompt += name.endswith('?') and ' ' or ': '
      while True:
          try:
              rv = raw_input(prompt)
          except NameError:
              rv = input(prompt)
          if rv:
              return rv
          if default is not None:
              return default
docs: Grab user input from command line.
  
      :param name: prompt text
      :param default: default value if no input provided.