check if object is not none in python