What is the best way to emulate s = hash["key"] or return nil of ruby in python?