Optional pattern (Maybe monad) in python