public static <T extends Enum<?>> T lookup(Map<String, T> lookup, String name, boolean fuzzy) {
		String testName = name.replaceAll("[ _]", "").toLowerCase();

		T type = lookup.get(testName);
		if (type != null) {
			return type;
		}

		if (!fuzzy) {
			return null;
		}

		int minDist = Integer.MAX_VALUE;

		for (Map.Entry<String, T> entry : lookup.entrySet()) {
			final String key = entry.getKey();
			if (key.charAt(0) != testName.charAt(0)) {
				continue;
			}

			int dist = getLevenshteinDistance(key, testName);

			if (dist >= minDist) {
				minDist = dist;
				type = entry.getValue();
			}
		}

		if (minDist > 1) {
			return null;
		}

		return type;
	}