code: def tr_from_header(images):
      """Return the TR from the header of an image or list of images.
  
      Parameters
      ----------
      images : image or list of images
        Single or multiple input 4d images representing one or
        several sessions.
  
      Returns
      -------
      float
        Repetition time, as specified in NIfTI header.
  
      Raises
      ------
      ValueError
        if the TR between the images is inconsistent.
      """
      if not isinstance(images, list):
          images = [images]
      images_tr = None
      for image in images:
          tr = get_header(image).get_zooms()[3]
          if images_tr is None:
              images_tr = tr
          if tr != images_tr:
              raise ValueError("TR inconsistent between images.")
      return images_tr
  
imports: import os
  import warnings
  import numpy
  from nibabel import io_orientation
  from nibabel.affines import apply_affine
  from ...core.image.image_spaces import as_xyz_image, make_xyz_image, xyz_affine
  from ...io.nibcompat import get_header
  from ..slicetiming import timefuncs
  from ._registration import _cspline_sample3d, _cspline_sample4d, _cspline_transform
  from .affine import Affine, Rigid
  from .optimizer import configure_optimizer, use_derivatives
  from .type_check import check_type, check_type_and_shape
label_desc: Use image node_id 5 for calling a global function with example usage: tr_from_header(images) and returns: images_tr