[python] Why is this printing 'None' in the output?