code: def flip(imagelist, axis=1):
      """Randomly flip spatial dimensions
  
      Args:
          imagelist (np.ndarray or list or tuple): image(s) to be flipped
          axis (int): axis along which to flip the images
  
      Returns:
          np.ndarray or list or tuple: same as imagelist but randomly flipped
              along axis
      """
  
      # Check if a single image or a list of images has been passed
      was_singular = False
      if isinstance(imagelist, np.ndarray):
          imagelist = [imagelist]
          was_singular = True
  
      # With a probility of 0.5 flip the image(s) across `axis`
      do_flip = np.random.random(1)
      if do_flip > 0.5:
          for i in range(len(imagelist)):
              imagelist[i] = np.flip(imagelist[i], axis=axis)
      if was_singular:
          return imagelist[0]
      return imagelist
  
file_path: DLTK/dltk/io/augmentation.py
imports: from __future__ import unicode_literals
  from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import numpy
  from scipy.ndimage.interpolation import map_coordinates
  from scipy.ndimage.filters import gaussian_filter
label_desc: Use image node_id 1 for calling a global function with example usage: flip(imagelist, axis) and returns: imagelist, imagelist