Returns a textual description of the contents of the argument passed
        as a buffer or None if an error occurred and the MAGIC_ERROR flag
        is set. A call to errno() will return the numeric error code.

def buffer(self, buf):
        """
        Returns a textual description of the contents of the argument passed
        as a buffer or None if an error occurred and the MAGIC_ERROR flag
        is set. A call to errno() will return the numeric error code.
        """
        try:  # attempt python3 approach first
            return str(_buffer(self._magic_t, buf, len(buf)), 'utf-8')
        except:
            return _buffer(self._magic_t, buf, len(buf))