code: def filter_custom_hetero_store(
      feature_store: FeatureStore,
      graph_store: GraphStore,
      node_dict: Dict[str, Tensor],
      row_dict: Dict[str, Tensor],
      col_dict: Dict[str, Tensor],
      edge_dict: Dict[str, OptTensor],
      custom_cls: Optional[HeteroData] = None,
  ) -> HeteroData:
      r"""Constructs a :class:`~torch_geometric.data.HeteroData` object from a
      feature store and graph store instance.
      """
      # Construct a new `HeteroData` object:
      data = custom_cls() if custom_cls is not None else HeteroData()
  
      # Filter edge storage:
      # TODO support edge attributes
      for attr in graph_store.get_all_edge_attrs():
          key = attr.edge_type
          if key in row_dict and key in col_dict:
              edge_index = torch.stack(
                  [row_dict[key], col_dict[key]], dim=0
              )
              data[attr.edge_type].edge_index = edge_index
  
      # Filter node storage:
      required_attrs = []
      for attr in feature_store.get_all_tensor_attrs():
          if attr.group_name in node_dict:
              attr.index = node_dict[attr.group_name]
              required_attrs.append(attr)
              data[attr.group_name].num_nodes = attr.index.size(0)
  
      # NOTE Here, we utilize `feature_store.multi_get` to give the feature store
      # full control over optimizing how it returns features (since the call is
      # synchronous, this amounts to giving the feature store control over all
      # iteration).
      tensors = feature_store.multi_get_tensor(required_attrs)
      for i, attr in enumerate(required_attrs):
          data[attr.group_name][attr.attr_name] = tensors[i]
  
      return data
  
imports: import copy
  import logging
  import math
  from typing import Any, Dict, Optional, Tuple, Union
  import numpy
  import torch
  from torch import Tensor
  import torch_geometric.typing
  from torch_geometric import EdgeIndex
  from torch_geometric.data import Data, FeatureStore, GraphStore, HeteroData, TensorAttr, remote_backend_utils
  from torch_geometric.data.storage import EdgeStorage, NodeStorage
  from torch_geometric.typing import EdgeType, FeatureTensorType, InputEdges, InputNodes, NodeType, OptTensor, SparseTensor, TensorFrame
label_desc: Use image node_id 7 for calling a global function with example usage: filter_custom_hetero_store(feature_store, graph_store, node_dict, row_dict, col_dict, edge_dict, custom_cls) and returns: data