Access to ioreg using Python?

The ioreg utility uses IOKit to get the values for for example the battery status of the Magic Mouse.

You can access IOKit from Python using ctypes - a foreign function library for Python. It allows you to call C/Objective C functions etc. from Python.

You can see an example of how to that with IOKit here:

https://github.com/pudquick/pypmset/blob/master/pypmset.py

In addition you'll find that someone already creeated a wrapper for IOKit to be accessible from Python here:

https://github.com/mosen/moobjc-framework-IOKit