def METHOD_NAME(v):
    if isinstance(v, str):
        return SortType(v.lower()).value
    if isinstance(v, SortType):
        return v.value
    raise ValueError("Invalid shuffle type value: {}".format(v))