<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_nearest(a, value, index=False):
 """ Find the array value, or index of the array value, closest to some given value. Args: a (ndarray) value (float) index (bool):
 whether to return the index instead of the array value. Returns: float. The array value (or index, as int) nearest the specified value. """

    i = np.abs(a - value).argmin()
    if index:
        return i
    else:
        return a[i]