docs: def thread_specific_tmprootdir():
      """
      Context manager which makes a thread specific gDirectory to avoid
      interfering with the current file.
  
      Use cases:
  
          A TTree Draw function which doesn't want to interfere with whatever
          gDirectory happens to be.
  
          Multi-threading where there are two threads creating objects with the
          same name which must reside in a directory. (again, this happens with
          TTree draw)
      """
      with preserve_current_directory():
          dname = "rootpy-tmp/thread/{0}".format(
                  threading.current_thread().ident)
          d = ROOT.gROOT.mkdir(dname)
          if not d:
              d = ROOT.gROOT.GetDirectory(dname)
              assert d, "Unexpected failure, can't cd to tmpdir."
          d.cd()
          yield d