How did you installed the library ?
As you can see here:
The original code does not contain a syntax error, I would recommend a git clone to prevent such errors: git clone https://github.com/bluerobotics/ms5837-python, remember to install git with: sudo apt install git.
We have an Arduino library here:
You could take a look on it to help you with the stm32 code.