Python Base Conversion Function In Sql