def METHOD_NAME(value, system):
    if value['status'] in ['deleted', 'replaced', 'revoked']:
        return
    if 'related_datasets' not in value:
        return
    treatment_duration_units = set()
    for assay in value['related_datasets']:
        if assay['status'] not in ['deleted', 'replaced', 'revoked']:
            if 'replicates' in assay:
                for rep in assay['replicates']:
                    if rep['status'] not in ['deleted'] and \
                       'library' in rep and 'biosample' in rep['library']:
                        biosample_object = rep['library']['biosample']
                        if 'treatments' in biosample_object:
                            if len(biosample_object['treatments']) != 0:
                                for t in biosample_object['treatments']:
                                    treatment_duration_units.add(t['duration_units'])
    if len(treatment_duration_units) > 1:
        detail = (f"Treatments associated with series {audit_link(path_to_text(value['@id']), value['@id'])} "
            f"use inconsistent duration units {treatment_duration_units}."
        )
        yield AuditFailure('inconsistent treatment units',
                           detail, level='INTERNAL_ACTION')
        return