code: def _apply_transform_spec(all_rows, transform_spec):
      """Applies transform_spec.func to all rows in all_rows (if func is specified). Removes all fields as specified by
      transform_spec.removed_fields, unless the fields were already deleted by transform_spec.func.
  
      All modifications are performed in-place.
      """
      if transform_spec.func:
          all_rows = [transform_spec.func(row) for row in all_rows]
  
      for field_to_remove in transform_spec.removed_fields:
          for row in all_rows:
              if field_to_remove in row:
                  del row[field_to_remove]
  
      return all_rows
  
imports: from __future__ import division
  import hashlib
  import threading
  from collections.abc import Iterable
  import numpy
  from pyarrow import parquet
  from pyarrow.parquet import ParquetFile
  from petastorm import utils
  from petastorm.cache import NullCache
  from petastorm.workers_pool import EmptyResultError
  from petastorm.workers_pool.worker_base import WorkerBase
label_desc: Use image node_id 2 for calling a global function with example usage: _apply_transform_spec(all_rows, transform_spec) and returns: all_rows