This documents how I installed Python bindings for libmagic.
There are actually different bindings for libmagic. One set is part of the original distribution. It can be found in /usr/src/contrib/file/python/. But in my opinion it is somewhat cumbersome to use and not very Pythonic.
The implementation from ahupp/python-magic in Github feels more natural.