code: def sync_shuffle(data, num_samples=None):
      if num_samples is None:
          num_samples_set = set(
              int(i.shape[0]) for i in tree.flatten(data)
          )
          assert len(num_samples_set) == 1
          num_samples = num_samples_set.pop()
      p = np.random.permutation(num_samples)
      return tree.map_structure(lambda x: x[p], data)
  
file_path: keras/keras/trainers/data_adapters/data_adapter_utils.py
imports: import math
  import numpy
  import tree
  from keras import backend
  from keras.api_export import keras_export
label_desc: Use image node_id 5 for calling a global function with example usage: sync_shuffle(data, num_samples) and returns: tree