Data Conversion Function In Python Syntax Error