code: def from_dglgraph(
      g: DGLGraph,
      is_homogeneous: bool = False,
      include_original_edge_id: bool = False,
  ) -> FusedCSCSamplingGraph:
      """Convert a DGLGraph to FusedCSCSamplingGraph."""
  
      homo_g, ntype_count, _ = to_homogeneous(
          g, ndata=g.ndata, edata=g.edata, return_count=True
      )
  
      if is_homogeneous:
          node_type_to_id = None
          edge_type_to_id = None
      else:
          # Initialize metadata.
          node_type_to_id = {
              ntype: g.get_ntype_id(ntype) for ntype in g.ntypes
          }
          edge_type_to_id = {
              etype_tuple_to_str(etype): g.get_etype_id(etype)
              for etype in g.canonical_etypes
          }
  
      # Obtain CSC matrix.
      indptr, indices, edge_ids = homo_g.adj_tensors("csc")
      ntype_count.insert(0, 0)
      node_type_offset = (
          None
          if is_homogeneous
          else torch.cumsum(torch.LongTensor(ntype_count), 0)
      )
  
      # Assign edge type according to the order of CSC matrix.
      type_per_edge = (
          None
          if is_homogeneous
          else torch.index_select(
              homo_g.edata[ETYPE], dim=0, index=edge_ids
          )
      )
  
      node_attributes = {}
      edge_attributes = {}
      for feat_name, feat_data in homo_g.ndata.items():
          if feat_name not in (NID, NTYPE):
              node_attributes[feat_name] = feat_data
      for feat_name, feat_data in homo_g.edata.items():
          if feat_name not in (EID, ETYPE):
              edge_attributes[feat_name] = feat_data
      if include_original_edge_id:
          # Assign edge attributes according to the original eids mapping.
          edge_attributes[ORIGINAL_EDGE_ID] = torch.index_select(
              homo_g.edata[EID], dim=0, index=edge_ids
          )
  
      return FusedCSCSamplingGraph(
          torch.ops.graphbolt.fused_csc_sampling_graph(
              indptr,
              indices,
              node_type_offset,
              type_per_edge,
              node_type_to_id,
              edge_type_to_id,
              node_attributes,
              edge_attributes,
          ),
      )
  
imports: from typing import Dict, Optional, Union
  import torch
  from dgl.utils import recursive_apply
  from ...base import EID, ETYPE, NID, NTYPE
  from ...convert import to_homogeneous
  from ...heterograph import DGLGraph
  from ..base import etype_str_to_tuple, etype_tuple_to_str, ORIGINAL_EDGE_ID
  from ..sampling_graph import SamplingGraph
  from .sampled_subgraph_impl import CSCFormatBase, SampledSubgraphImpl
label_desc: Use image node_id 4 for calling a global function with example usage: from_dglgraph(g, is_homogeneous, include_original_edge_id) and returns: FusedCSCSamplingGraph