code: def _check_homo_data_edges(
      original: Data,
      padded: Data,
      max_num_edges: Optional[int] = None,
      edge_pad_value: Optional[Padding] = None,
      is_mask_available: bool = False,
      exclude_keys: Optional[List[str]] = None,
  ):
      # Check edge index attribute.
      if max_num_edges is None:
          max_num_edges = padded.num_nodes**2
      assert padded.num_edges == max_num_edges
      assert padded.edge_index.shape[1] == max_num_edges
      assert padded.edge_index.shape[1] == max_num_edges
  
      compare_pad_start_idx = original.num_edges
      expected_node = original.num_nodes
  
      # Check values in padded area.
      assert all(
          padded.edge_index[0, i]
          == padded.edge_index[1, i]
          == expected_node
          for i in range(compare_pad_start_idx, max_num_edges)
      )
      # Check values in non-padded area.
      assert torch.equal(
          original.edge_index,
          padded.edge_index[:, :compare_pad_start_idx],
      )
  
      if is_mask_available:
          assert padded.pad_edge_mask.numel() == padded.num_edges
          assert torch.all(padded.pad_edge_mask[:compare_pad_start_idx])
          assert not torch.any(
              padded.pad_edge_mask[compare_pad_start_idx:]
          )
  
      # Check other attributes.
      for attr in _generate_homodata_edge_attrs(original):
          if attr == "edge_index":
              continue
          if attr in exclude_keys:
              assert attr not in padded.keys()
              continue
  
          assert attr in padded.keys()
  
          if not isinstance(padded[attr], torch.Tensor):
              continue
  
          assert padded[attr].shape[0] == max_num_edges
  
          # Check values in padded area.
          pad_value = (
              edge_pad_value.get_value(None, attr)
              if edge_pad_value is not None
              else 0.0
          )
          assert all(
              i == pad_value
              for i in torch.flatten(
                  padded[attr][compare_pad_start_idx:, :]
              )
          )
  
          # Check values in non-padded area.
          assert torch.equal(
              original[attr], padded[attr][: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 8 for calling a global function with example usage: _check_homo_data_edges(original, padded, max_num_edges, edge_pad_value, is_mask_available, exclude_keys) without return types