[python] How to convert Nonetype to int or string?