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:
        s = __builtin__.repr(x)
        if len(s) > self.maxother:
            i = max(0, (self.maxother-3)//2)
            j = max(0, self.maxother-3-i)
            s = s[:i] + '...' + s[len(s)-j:]
        return s