Update compass.py

copied the missing definitions across from accelerometer.py