code: def create_heterogenous_dgl_block_from_tensors_dict(
      edges_dict: Dict[
          Tuple(str, str, str),
          (torch.Tensor, torch.Tensor, torch.Tensor),
      ],
      num_nodes_dict: Dict[str, torch.Tensor],
      seed_nodes: Optional[Dict[str, torch.Tensor]],
  ):
      data_dict = {k: (s, d) for k, (s, d, _) in edges_dict.items()}
      edge_ids_dict = {k: eid for k, (_, _, eid) in edges_dict.items()}
  
      sampled_graph = dgl.heterograph(
          data_dict=data_dict,
          num_nodes_dict=num_nodes_dict,
      )
      sampled_graph.edata[dgl.EID] = edge_ids_dict
  
      src_d = defaultdict(list)
      dst_d = defaultdict(list)
  
      for (s, _, d), (src_id, dst_id) in data_dict.items():
          src_d[s].append(src_id)
          dst_d[d].append(dst_id)
  
      src_d = {
          k: torch.cat(v).unique()
          for k, v in src_d.items()
          if len(v) > 0
      }
      if seed_nodes is None:
          seed_nodes = {
              k: torch.cat(v).unique()
              for k, v in dst_d.items()
              if len(v) > 0
          }
  
      block = dgl.to_block(
          sampled_graph, dst_nodes=seed_nodes, src_nodes=src_d
      )
      block.edata[dgl.EID] = sampled_graph.edata[dgl.EID]
      return block
  
imports: from __future__ import annotations
  from typing import List, Tuple, Dict, Optional
  from collections import defaultdict
  import cudf
  from cugraph.utilities.utils import import_optional
  from cugraph_dgl.nn import SparseGraph
label_desc: Use image node_id 14 for calling a global function with example usage: create_heterogenous_dgl_block_from_tensors_dict(edges_dict, num_nodes_dict, seed_nodes) and returns: block