title: Safe dereferencing in Python
body: <p>Groovy has a nice operator for safe dereferencing, which helps to avoid NullPointerExceptions:</p>
  
  <pre><code>variable?.method()
  </code></pre>
  
  <p>The <code>method</code> will only be called, if <code>variable</code> is not <code>null</code>.</p>
  
  <p>Is there a way to do the same in Python? Or do I have to write <code>if variable: variable.method()</code>?</p>