Return elements which falls within specified interquartile range.

    Arguments:

        array (list): Sequence of numbers.
        lower (float): Lower bound for IQR, in range 0 <= lower <= 1.
        upper (float): Upper bound for IQR, in range 0 <= upper <= 1.

    Returns:

        list: Copy of original list, with elements outside of IQR
          removed.

def filter_iqr(array, lower, upper):
    """
    Return elements which falls within specified interquartile range.

    Arguments:

        array (list): Sequence of numbers.
        lower (float): Lower bound for IQR, in range 0 <= lower <= 1.
        upper (float): Upper bound for IQR, in range 0 <= upper <= 1.

    Returns:

        list: Copy of original list, with elements outside of IQR
          removed.
    """
    upper, lower = iqr(array, upper, lower)

    new = list(array)
    for x in new[:]:
        if x < lower or x > upper:
            new.remove(x)

    return new