def _autotuple(a):
    """Automatically convert the supplied iterable to a scalar or tuple as appropriate."""
    if not hasattr(a, "__iter__"):
        return a
    if len(a) == 1:
        return a[0]
    return tuple(a)