code: def check_rename(pool):
      state = pool.__state__
      new_pool = type(pool)
      res = pool.map(squared, range(2))
      assert res == [0, 1]
      old_id = pool._id
  
      # change the 'id'
      pool._id = "foobar"
      pool = new_pool()  # blow away the 'id' change
      res = pool.map(squared, range(2))
      assert res == [0, 1]
      assert len(state) == 1
      assert "foobar" not in list(state.keys())
  
      # change the 'id', but don't re-init
      pool._id = "foobar"
      res = pool.map(squared, range(2))
      assert res == [0, 1]
      assert len(state) == 2
      assert "foobar" in list(state.keys())
  
      pool.close()
      try:
          pool.map(squared, range(2))
      except PoolClosedError:
          pass
      else:
          raise AssertionError
      pool.terminate()
      assert len(state) == 2
      assert "foobar" in list(state.keys())
      pool.clear()
      assert len(state) == 1
      assert "foobar" not in list(state.keys())
  
      pool._id = old_id
      res = pool.map(squared, range(2))
      assert res == [0, 1]
      pool.terminate()
      pool.clear()
      assert len(state) == 0
      return
  
file_path: pathos/pathos/tests/test_join.py
imports: from pathos.parallel import *
  from pathos.multiprocessing import *
  from pathos.threading import *
  from pathos.helpers import cpu_count
  import sys
  import dill
label_desc: Use image node_id 4 for calling a global function with example usage: check_rename(pool) without return types