def scalar(input):
    """Accepts scalars and lists of length one, returns a scalar."""
    try:
        if len(input) == 1:
            return input[0]
        raise ValueError(f"Not a scalar: {input}")
    except:
        return input