code: def test_pickling_is_pinned(idtype):
      from copy import deepcopy
  
      g = dgl.rand_graph(10, 20, idtype=idtype, device=F.cpu())
      hg = dgl.heterograph(
          {
              ("user", "follows", "user"): ([0, 1], [1, 2]),
              ("user", "plays", "game"): ([0, 1, 2, 1], [0, 0, 1, 1]),
              ("user", "wishes", "game"): ([0, 2], [1, 0]),
              ("developer", "develops", "game"): ([0, 1], [0, 1]),
          },
          idtype=idtype,
          device=F.cpu(),
      )
      for graph in [g, hg]:
          assert not graph.is_pinned()
          graph.pin_memory_()
          assert graph.is_pinned()
          pg = _reconstruct_pickle(graph)
          assert pg.is_pinned()
          pg.unpin_memory_()
          dg = deepcopy(graph)
          assert dg.is_pinned()
          dg.unpin_memory_()
          graph.unpin_memory_()
  
imports: import io
  import pickle
  import unittest
  import backend
  import dgl
  import dgl.function
  import networkx
  import pytest
  import scipy.sparse
  from dgl.graph_index import create_graph_index
  from dgl.utils import toindex
  from utils import assert_is_identical, assert_is_identical_hetero, check_graph_equal, get_cases, parametrize_idtype
label_desc: Use image node_id 12 for calling a global function with example usage: test_pickling_is_pinned(idtype) without return types