```qiime.util.MetadataMap``` has this functionality (```MetadataMap.hasSingleCategoryValue```). It may be better to use that class here for this check.