python if type is not nonetype