def __repr__(self):
     rc = getglobal('repr_counter')
     # checking for cyclic references
     if rc > 20:
         print "Warning: repr_counter reached %r - possibly got cyclic references" % rc
         return "..."
     elif id(self) in repr_list:
         if getglobal('dublicate_repr'):
             return self._show_dublicates()
         else:
             setglobal('dublicate_repr', True)
             #            print "Info: got cyclic references for %r" % self.clsname
             res = "Dublicate{%s}" % self._show_dublicates()
             setglobal('dublicate_repr', False)
             return res
     else:
         setglobal('repr_counter', rc + 1)
         repr_list.append(id(self))
         #            print "======== repr_counter reached %r" % lc
         if getglobal('DEBUG_PRINT'):
             rres = self._repr_inner(*args, **kwargs)
         else:
             rres = self._pretty_inner(*args, **kwargs)
         repr_list.pop()
         setglobal('repr_counter', rc)
         return rres
 def lge(self, *args, **kwargs):
     lc = getglobal('lge_counter')
     # checking for cyclic references
     if lc > 20:
         print "Warning: lge_counter reached %r - possibly got cyclic references" % lc
         return (0, 0, 1)
     else:
         setglobal('lge_counter', lc + 1)
         #            print "======== lge_counter reached %r" % lc
         lres = self._lge_inner(*args, **kwargs)
         setglobal('lge_counter', lc)
         return lres