title: How to pass "random" amount of variables not all of them exist
body: <p>I have a method to validate input:</p>
  
  <pre><code>def validate_user_input(*args):
      for item in args:
          if not re.match('^[a-zA-Z0-9_-]+$', item):
  </code></pre>
  
  <p>And I'm calling it like this:</p>
  
  <pre><code>validate_user_input(var1, var2, ..., var7)
  </code></pre>
  
  <p>But those are generated from user input, and some of those can be missing. What would be the proper way to do that, without creating tons of if statements?</p>
  
  <p>Variables are assigned from a json input like so, and json input might not have some of the needed properties:</p>
  
  <pre><code>var1 = request.json.get('var1')
  </code></pre>
  
  <p>I assume they are <code>&lt;class 'NoneType'&gt;</code></p>
  
  <p>Here's the error: <code>TypeError: expected string or buffer</code></p>