code: def prevent_recursion(default):
      
      def decorator(func):
          name = '_calling_%s_' % func.__name__
  
          def newfunc(self, *args, **kwds):
              if getattr(self, name, False):
                  return default()
              setattr(self, name, True)
              try:
                  return func(self, *args, **kwds)
              finally:
                  setattr(self, name, False)
          return newfunc
      return decorator
docs: A decorator that returns the return value of `default` in recursions