code: def _apply_transform_to_key_and_copy(sample, transform, key, seed=0):
      """
      This helper function takes a sample, makes a copy, applies the
      provided transform to the appropriate key in the copied sample and
      returns the copy. It's solely to help make sure the copying /
      random seed happens correctly throughout the file.
  
      It is useful for constructing the expected sample field in the
      transform checks.
      """
      expected_sample = copy.deepcopy(sample)
      torch.manual_seed(seed)
      numpy.random.seed(seed)
      random.seed(seed)
      is_tuple = False
      if isinstance(expected_sample, tuple):
          expected_sample = list(expected_sample)
          is_tuple = True
      expected_sample[key] = transform(expected_sample[key])
      return tuple(expected_sample) if is_tuple else expected_sample
  
file_path: ClassyVision/test/dataset_transforms_util_test.py
imports: import copy
  import random
  import unittest
  import numpy
  import torch
  import torchvision.transforms
  from classy_vision.dataset.core.random_image_datasets import RandomImageBinaryClassDataset, SampleType
  from classy_vision.dataset.transforms import build_transforms
  from classy_vision.dataset.transforms.util import build_field_transform_default_imagenet, GenericImageTransform, ImagenetAugmentTransform, ImagenetNoAugmentTransform
label_desc: Use image node_id 1 for calling a global function with example usage: _apply_transform_to_key_and_copy(sample, transform, key, seed) and returns: unknown