I think you can get rid of the ```is None``` check, since that case would be caught by the ```isinstance``` call.