def margined(arr, prop):
    """Returns (min(arr) - epsilon, max(arr) - epsilon), where
    epsilon = (max(arr) - min(arr)) * prop. This gives the range of
    values within arr along with some margin on the ends.
        ARR: a NumPy array
        PROP: a float"""
    worst = arr.min()
    best = arr.max()
    margin = (best - worst) * prop
    return (worst - margin, best + margin)