title: Python function - if input variable doesn't exist then use default value
body: <pre><code>def funcname(var1, var2 = "1234"):
  
      output = int(var2)
  
      return output
  </code></pre>
  
  <p>Is there a way to catch error in case where <code>var2</code> does not exist i.e. function defines a default value (above) and is called:</p>
  
  <pre><code>result = funcname(var1, var2 = cs) 
  </code></pre>
  
  <p>but <code>cs</code> does not exist so in case where <code>cs</code> variable does not exist I would like <code>var2</code> to inherit the default value rather that error as <code>cs</code> not defined.</p>