def METHOD_NAME(self, x, level):
    typename = type(x).__name__
    if ' ' in typename:
        parts = typename.split()
        typename = '_'.join(parts)
    if hasattr(self, 'repr_' + typename):
        return getattr(self, 'repr_' + typename)(x, level)
    else:
        return self.repr_instance(x, level)