def shift_and_trim(array, dist):
    """Shift and trim unneeded item.

    :params array: list like iterable object
    :params dist: int

    Example::

        >>> array = [0, 1, 2]

        >>> shift_and_trim(array, 0)
        [0, 1, 2]
        >>> shift_and_trim(array, 1)
        [0, 1]

        >>> shift_and_trim(array, -1)
        [1, 2]

        >>> shift_and_trim(array, 3)
        []

        >>> shift_and_trim(array, -3)
        []
    """
    length = len(array)
    if length == 0:
        return []

    if (dist >= length) or (dist <= -length):
        return []
    elif dist < 0:
        return array[-dist:]
    elif dist > 0:
        return array[:-dist]
    else:
        return list(array)
Shift and trim unneeded item.

    :params array: list like iterable object
    :params dist: int

    Example::

        >>> array = [0, 1, 2]

        >>> shift_and_trim(array, 0)
        [0, 1, 2]
        >>> shift_and_trim(array, 1)
        [0, 1]

        >>> shift_and_trim(array, -1)
        [1, 2]

        >>> shift_and_trim(array, 3)
        []

        >>> shift_and_trim(array, -3)
        []