code: def permute(data: Data, perm: Tensor, log: bool = True) -> Data:
      r"""Permutes a :obj:`data` object according to a given permutation
      :obj:`perm`."""
  
      if log:
          t = time.perf_counter()
          print("Permuting data...", end=" ", flush=True)
  
      data = copy.copy(data)
      for key, value in data:
          if (
              isinstance(value, Tensor)
              and value.size(0) == data.num_nodes
          ):
              data[key] = value[perm]
          elif (
              isinstance(value, Tensor)
              and value.size(0) == data.num_edges
          ):
              raise NotImplementedError
          elif isinstance(value, SparseTensor):
              data[key] = value.permute(perm)
  
      if log:
          print(f"Done! [{time.perf_counter() - t:.2f}s]")
  
      return data
  
file_path: DIG/dig/lsgraph/method/GraphFMOB/metis.py
imports: from typing import Tuple
  import time
  import copy
  import torch
  from torch import Tensor
  from torch_sparse import SparseTensor
  from torch_geometric.data import Data
label_desc: Use image node_id 2 for calling a global function with example usage: permute(data, perm, log) and returns: data