nodes: 0, module; 1, function_definition; 2, function_name:_get_sorted_mosaics; 3, parameters; 4, block; 5, identifier:dicom_input; 6, expression_statement; 7, comment:# Order all dicom files by acquisition number; 8, expression_statement; 9, for_statement; 10, return_statement; 11, comment:"""
      Search all mosaics in the dicom directory, sort and validate them
      """; 12, assignment; 13, identifier:index; 14, call; 15, comment:# Validate that there are no duplicate AcquisitionNumber; 16, block; 17, identifier:sorted_mosaics; 18, identifier:sorted_mosaics; 19, call; 20, identifier:range; 21, argument_list; 22, if_statement; 23, identifier:sorted; 24, argument_list; 25, integer:0; 26, binary_operator:len(sorted_mosaics) - 1; 27, comparison_operator:sorted_mosaics[index].AcquisitionNumber >= sorted_mosaics[index + 1].AcquisitionNumber; 28, block; 29, identifier:dicom_input; 30, keyword_argument; 31, call; 32, integer:1; 33, attribute; 34, attribute; 35, raise_statement; 36, identifier:key; 37, lambda; 38, identifier:len; 39, argument_list; 40, subscript; 41, identifier:AcquisitionNumber; 42, subscript; 43, identifier:AcquisitionNumber; 44, call; 45, lambda_parameters; 46, attribute; 47, identifier:sorted_mosaics; 48, identifier:sorted_mosaics; 49, identifier:index; 50, identifier:sorted_mosaics; 51, binary_operator:index + 1; 52, identifier:ConversionValidationError; 53, argument_list; 54, identifier:x; 55, identifier:x; 56, identifier:AcquisitionNumber; 57, identifier:index; 58, integer:1; 59, string:"INCONSISTENT_ACQUISITION_NUMBERS"
code: def _get_sorted_mosaics(dicom_input):
      """
      Search all mosaics in the dicom directory, sort and validate them
      """
      # Order all dicom files by acquisition number
      sorted_mosaics = sorted(dicom_input, key=lambda x: x.AcquisitionNumber)
  
      for index in range(0, len(sorted_mosaics) - 1):
          # Validate that there are no duplicate AcquisitionNumber
          if sorted_mosaics[index].AcquisitionNumber >= sorted_mosaics[index + 1].AcquisitionNumber:
              raise ConversionValidationError("INCONSISTENT_ACQUISITION_NUMBERS")
  
      return sorted_mosaics