code: def read_dicom_phases(dicom_path, sort_instance=True):
      """Read dicom images of multiple instances/phases for one patient.
  
      Args:
          dicom_path (str): Path to DICOM images.
          sort_instance (bool, optional): Whether sort images by InstanceNumber (i.e. phase number). Defaults to True.
  
      Returns:
          [list]: List of dicom dataset objects
      """
      dcm_phases = []  # list of dicom dataset objects (phases)
      # get all dicom files under the directory
      phase_files = glob.glob(dicom_path + "/**/*.dcm", recursive=True)
      for phase_file in phase_files:
          dataset = pydicom.dcmread(phase_file)
          setattr(dataset, "FilePath", phase_file)
          dcm_phases.append(dataset)
      if sort_instance:
          dcm_phases.sort(key=lambda x: x.InstanceNumber, reverse=False)
  
      return dcm_phases
  
imports: import glob
  import logging
  import os
  from enum import Enum
  import numpy
  import pydicom
  import torch
  from torchvision import datasets, transforms
  from kale.loaddata.dataset_access import DatasetAccess
  from kale.loaddata.mnistm import MNISTM
  from kale.loaddata.multi_domain import MultiDomainAccess, MultiDomainImageFolder
  from kale.loaddata.usps import USPS
  from kale.prepdata.image_transform import get_transform
  from kale.utils.download import download_file_by_url
label_desc: Use image node_id 2 for calling a global function with example usage: read_dicom_phases(dicom_path, sort_instance) and returns: dcm_phases