python check if type is not nonetype