human
Complete this python program:
def accept_singleton(expected_type, position=1):
assistant
#Here is the Python program you requested.

    """Allows a function expecting a list to accept a single item as well.
    The item will be wrapped in a list.
    Will not work for nested lists.
    :param expected_type: the type of the items in the list
    :param position: (optional) the position of the expected list - defaults to 1.
    """
    @decorator
    def wrapper(function, *args, **kw):
        if isinstance(args[position], expected_type):
            args = list(args)
            args[position] = [args[position]]
            args = tuple(args)
        return function(*args, **kw)
    return wrapper