title: How do I restrict passed variable to specific values in python?
body: <p>I am writing the script where I pass values with CLI through <code>argparse</code> module. I am wondering if this is possible to restrict variable to hold pre-defined values, to avoid user mistake. It is <strong>not</strong> the type restriction, values are consists of letters as well as digits, surely I can write an <code>if</code> block, but I have about 30 pre-defined values, so writing something like </p>
  
  <pre><code>if var is value1 or var is value2 ... or var is value30:
    pass
  else:
      print("oops, your value does not fit")
  </code></pre>
  
  <p>would be painful. What is the proper way of doing this?</p>