def _StringToEnum(str_value, str_to_enum, default):
    """Converts a string to an enum based on provided dict."""
    str_value = str(str_value).lower()
    if str_value in str_to_enum:
        return str_to_enum[str_value]
    return default