Compensation formluas for the BMM150 are today only available as C code in its official sensor API on our GitHub page.
Unfortunately in your case you will need to convert the functions needed in Python, including the read-out of trimming registers, read-out of raw sensor data, and the appropriate compensation formulas (I would assume floating point implementation to be ideal in Python).
... View more