code: def defer(self, func, *args, **kwargs):
          
          if thread.get_ident() == self.broker_ident:
              _vv and IOLOG.debug('%r.defer() [immediate]', self)
              return func(*args, **kwargs)
          if self._broker._exitted:
              raise Error(self.broker_shutdown_msg)
  
          _vv and IOLOG.debug('%r.defer() [fd=%r]', self, self.transmit_side.fd)
          self._lock.acquire()
          try:
              if not self._deferred:
                  self._wake()
              self._deferred.append((func, args, kwargs))
          finally:
              self._lock.release()
docs: Arrange for `func()` to execute on the broker thread. This function
          returns immediately without waiting the result of `func()`. Use
          :meth:`defer_sync` to block until a result is available.
  
          :raises mitogen.core.Error:
              :meth:`defer` was called after :class:`Broker` has begun shutdown.