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