code: def _create_hetero_subgraph(
      parent,
      sgi,
      induced_nodes_or_device,
      induced_edges_or_device,
      store_ids=True,
  ):
      """Internal function to create a subgraph.
  
      Parameters
      ----------
      parent : DGLGraph
          The parent DGLGraph.
      sgi : HeteroSubgraphIndex
          Subgraph object returned by CAPI.
      induced_nodes_or_device : list[Tensor] or device or None
          Induced node IDs or the device. Will store it as the dgl.NID ndata unless it
          is None, which means the induced node IDs are the same as the parent node IDs.
          If a device is given, the features will be copied to the given device.
      induced_edges_or_device : list[Tensor] or device or None
          Induced edge IDs. Will store it as the dgl.EID ndata unless it
          is None, which means the induced edge IDs are the same as the parent edge IDs.
          If a device is given, the features will be copied to the given device.
      store_ids : bool
          If True and induced_nodes is not None, it will store the raw IDs of the extracted
          nodes in the ``ndata`` of the resulting graph under name ``dgl.NID``.
          If True and induced_edges is not None, it will store the raw IDs of the extracted
          edges in the ``edata`` of the resulting graph under name ``dgl.EID``.
  
      Returns
      -------
      DGLGraph
          Graph
      """
      # (BarclayII) Giving a device argument to induced_nodes_or_device is necessary for
      # UVA subgraphing, where the node features are not sliced but the device changed.
      # Not having this will give us a subgraph on GPU but node features on CPU if we don't
      # relabel the nodes.
      node_frames = utils.extract_node_subframes(
          parent, induced_nodes_or_device, store_ids
      )
      edge_frames = utils.extract_edge_subframes(
          parent, induced_edges_or_device, store_ids
      )
      hsg = DGLGraph(sgi.graph, parent.ntypes, parent.etypes)
      utils.set_new_frames(
          hsg, node_frames=node_frames, edge_frames=edge_frames
      )
      return hsg
  
file_path: dgl/python/dgl/subgraph.py
imports: from collections.abc import Mapping
  from .None import backend, graph_index, heterograph_index, utils
  from ._ffi.function import _init_api
  from .base import DGLError
  from .heterograph import DGLGraph
  from .utils import context_of, recursive_apply
label_desc: Use image node_id 9 for calling a global function with example usage: _create_hetero_subgraph(parent, sgi, induced_nodes_or_device, induced_edges_or_device, store_ids) and returns: hsg