Python Checking For Nonetype