from typing import List
from typing import Union
from typing import Any


def reduce(values: List) -> Union[List[Any], Any]:
    """ Reduce a list to a scalar if length == 1 """
    while isinstance(values, list) and len(values) == 1:
        values = values[0]
    return values