code: def _defersort(fn):
      def defersort(self, *args, **kwds):
          # may be called recursively; only the first call needs to block sorting
          setSorting = False
          if self._sorting is None:
              self._sorting = self.isSortingEnabled()
              setSorting = True
              self.setSortingEnabled(False)
          try:
              return fn(self, *args, **kwds)
          finally:
              if setSorting:
                  self.setSortingEnabled(self._sorting)
                  self._sorting = None
  
      return defersort
  
imports: import numpy
  from ..Qt import QtCore, QtGui, QtWidgets
label_desc: Use image node_id 1 for calling a global function with example usage: _defersort(fn) and returns: defersort, fn