What is the best way to implement the following code without having the same code duplicated in two different blocks, but while maintaining efficiency and readability?
if (expression1):
if (expression2 that can only be checked if expression1):
doSomething()
else:
doSomethingElse()
else:
doSomethingElse()