'Internal dispatcher
Tries the following concepts to print an expression:
1. Let the object print itself if it knows how.
2. Take the best fitting method defined in the printer.
3. As fall-back use the emptyPrinter method for the printer.'

def _print(self, expr, *args, **kwargs):

    self._print_level += 1
    try:
        if (self.printmethod and hasattr(expr, self.printmethod) and (not isinstance(expr, BasicMeta))):
            return getattr(expr, self.printmethod)(self, *args, **kwargs)
        for cls in type(expr).__mro__:
            printmethod = ('_print_' + cls.__name__)
            if hasattr(self, printmethod):
                return getattr(self, printmethod)(expr, *args, **kwargs)
        return self.emptyPrinter(expr)
    finally:
        self._print_level -= 1
