Selects a subset of a list based on a list of indices.
    This is similar to np.take, but pure python.

    Args:
        list_ (list): some indexable object
        index_list (list, slice, int): some indexing object

    Returns:
        list or scalar: subset of the list

    CommandLine:
        python -m utool.util_list --test-take

    SeeAlso:
        ut.dict_take
        ut.dict_subset
        ut.none_take
        ut.compress

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_list import *  # NOQA
        >>> list_ = [0, 1, 2, 3]
        >>> index_list = [2, 0]
        >>> result = take(list_, index_list)
        >>> print(result)
        [2, 0]

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_list import *  # NOQA
        >>> list_ = [0, 1, 2, 3]
        >>> index = 2
        >>> result = take(list_, index)
        >>> print(result)
        2

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_list import *  # NOQA
        >>> list_ = [0, 1, 2, 3]
        >>> index = slice(1, None, 2)
        >>> result = take(list_, index)
        >>> print(result)
        [1, 3]

def take(list_, index_list):
    """
    Selects a subset of a list based on a list of indices.
    This is similar to np.take, but pure python.

    Args:
        list_ (list): some indexable object
        index_list (list, slice, int): some indexing object

    Returns:
        list or scalar: subset of the list

    CommandLine:
        python -m utool.util_list --test-take

    SeeAlso:
        ut.dict_take
        ut.dict_subset
        ut.none_take
        ut.compress

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_list import *  # NOQA
        >>> list_ = [0, 1, 2, 3]
        >>> index_list = [2, 0]
        >>> result = take(list_, index_list)
        >>> print(result)
        [2, 0]

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_list import *  # NOQA
        >>> list_ = [0, 1, 2, 3]
        >>> index = 2
        >>> result = take(list_, index)
        >>> print(result)
        2

    Example:
        >>> # ENABLE_DOCTEST
        >>> from utool.util_list import *  # NOQA
        >>> list_ = [0, 1, 2, 3]
        >>> index = slice(1, None, 2)
        >>> result = take(list_, index)
        >>> print(result)
        [1, 3]
    """
    try:
        return [list_[index] for index in index_list]
    except TypeError:
        return list_[index_list]