title: python library for user input
body: <p>I am implementing a small command line tool in python that needs to ask the user a couple of questions. I use</p>
  
  <pre><code>raw_input('Are you male or female?')
  </code></pre>
  
  <p>all the time. Now I would like to be able to deal with dumb users (or those too lazy to read/remember the documentation), so I need to check whether the answer makes sense. </p>
  
  <pre><code>gender = ''
  while gender not in ['male', 'female']:
      gender = raw_input('Are you male or female?')
  </code></pre>
  
  <p>I am wondering whether there exists something like argparse that would automate this problem, something like </p>
  
  <pre><code>import inputparse 
  gender = inputparse.get_input(prompt='Are you male or female?', type=str, possible_input=['male', 'female'])
  </code></pre>
  
  <p>and would take care of automatic checking etc.?</p>