code: def _check_hetero_data_nodes(
      original: HeteroData,
      padded: HeteroData,
      max_num_nodes: Union[int, Dict[NodeType, int]],
      node_pad_value: Optional[Padding] = None,
      is_mask_available: bool = False,
      exclude_keys: Optional[List[str]] = None,
  ):
      if is_mask_available:
          for store in padded.node_stores:
              assert "pad_node_mask" in store
  
      expected_nodes = max_num_nodes
  
      for node_type, attr in _generate_heterodata_nodes(original):
          if attr in exclude_keys:
              assert attr not in padded[node_type].keys()
              continue
  
          assert attr in padded[node_type].keys()
  
          if not isinstance(padded[node_type][attr], torch.Tensor):
              continue
  
          compare_pad_start_idx = original[node_type].num_nodes
          padded_tensor = padded[node_type][attr]
  
          if attr == "pad_node_mask":
              assert (
                  padded_tensor.numel() == padded[node_type].num_nodes
              )
              assert torch.all(padded_tensor[:compare_pad_start_idx])
              assert not torch.any(
                  padded_tensor[compare_pad_start_idx:]
              )
              continue
  
          original_tensor = original[node_type][attr]
  
          # Check the number of nodes.
          if isinstance(max_num_nodes, dict):
              expected_nodes = max_num_nodes[node_type]
  
          assert padded_tensor.shape[0] == expected_nodes
  
          compare_pad_start_idx = original_tensor.shape[0]
          pad_value = (
              node_pad_value.get_value(node_type, attr)
              if node_pad_value is not None
              else 0.0
          )
          assert all(
              i == pad_value
              for i in torch.flatten(
                  padded_tensor[compare_pad_start_idx:]
              )
          )
          # Compare non-padded area with the original.
          assert torch.equal(
              original_tensor, padded_tensor[:compare_pad_start_idx]
          )
  
imports: import numbers
  from typing import Dict, Generator, List, Optional, Tuple, Union
  import pytest
  import torch
  from torch_geometric.data import Data, HeteroData
  from torch_geometric.datasets import FakeDataset, FakeHeteroDataset
  from torch_geometric.transforms import Pad
  from torch_geometric.transforms.pad import AttrNamePadding, EdgeTypePadding, NodeTypePadding, Padding, UniformPadding
  from torch_geometric.typing import EdgeType, NodeType
label_desc: Use image node_id 9 for calling a global function with example usage: _check_hetero_data_nodes(original, padded, max_num_nodes, node_pad_value, is_mask_available, exclude_keys) without return types