<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def find_previous(a, value, index=False, return_distance=False):
 """ Find the nearest array value, or index of the array value, before some given value. Optionally also return the fractional distance of the given value from that previous value. Args: a (ndarray) value (float) index (bool):
 whether to return the index instead of the array value. Default: False. return_distance(bool):
 whether to return the fractional distance from the nearest value to the specified value. Default: False. Returns: float. The array value (or index, as int) before the specified value. If ``return_distance==True`` then a tuple is returned, where the second value is the distance. """

    b = a - value
    i = np.where(b > 0)[0][0]
    d = (value - a[i-1]) / (a[i] - a[i-1])
    if index:
        if return_distance:
            return i - 1, d
        else:
            return i - 1
    else:
        if return_distance:
            return a[i - 1], d
        else:
            return a[i - 1]