code: def _is_compressed(dicom_file, force=False):
      
      header = pydicom.read_file(dicom_file,
                                 defer_size="1 KB",
                                 stop_before_pixels=True,
                                 force=force)
  
      uncompressed_types = ["1.2.840.10008.1.2",
                            "1.2.840.10008.1.2.1",
                            "1.2.840.10008.1.2.1.99",
                            "1.2.840.10008.1.2.2"]
  
      if 'TransferSyntaxUID' in header.file_meta and header.file_meta.TransferSyntaxUID in uncompressed_types:
          return False
      return True
docs: Check if dicoms are compressed or not