def validate_vm()

in src/utils/tags.py [0:0]


def validate_vm(obj):
    try:
        log.debug(f'Validing Tag {obj.keyword} VM : {obj.VM} VR: {obj.VR}')
        maxVM = pydicom._dicom_dict.DicomDictionary[obj.tag][1]
        split = maxVM.split('-')
        if len(split) > 1:
            min = split[0]
            max = split[1]
            if 'n' in max:
                max = math.inf
            else:
                max = int(max)
        else:
            min = int(split[0])
            max = min
        if max > 1:
            if isinstance(obj.value, pydicom.multival.MultiValue):
                return obj.value._list
            elif isinstance(obj.value, list):
                return obj.value
            else:
                return [obj.value]
        else:
            return str(obj.value)
    except Exception as e:
        log.error(e)
        raise