Python maths parser