code: def console_input(default, validation=None, allow_empty=False):
      
      value = raw_input("> ") or default
      if value == "" and not allow_empty:
          print "Invalid: Empty value is not permitted."
          return console_input(default, validation)
      if validation:
          try:
              return validation(value)
          except ValidationError, e:
              print "Invalid: ", e
              return console_input(default, validation)
      return value
docs: Get user input value from stdin
  
      Parameters
      ----------
      default : string
          A default value. It will be used when user input nothing.
      validation : callable
          A validation function. The validation function must raise an error
          when validation has failed.
  
      Returns
      -------
      string or any
          A user input string or validated value