<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def range_difference(data, ground_truth, mask=None, normalized=False, force_lower_is_better=True):
 r"""Return dynamic range difference between ``data`` and ``ground_truth``. Evaluates difference in range between input (``data``) and reference data (``ground_truth``). Allows for normalization (``normalized``) and a masking of the two spaces (``mask``). Parameters data : `array-like` Input data to compare to the ground truth. ground_truth : `array-like` Reference to which ``data`` should be compared. mask : `array-like`, optional Binary mask or index array to define ROI in which FOM evaluation is performed. normalized : bool, optional If ``True``, normalize the FOM to lie in [0, 1]. force_lower_is_better : bool, optional If ``True``, it is ensured that lower values correspond to better matches. For the range difference, this is already the case, and the flag is only present for compatibility to other figures of merit. Returns ------- rd : float FOM value, where a lower value means a better match. Notes ----- The FOM evaluates .. math:: \mathrm{RD}(f, g) = \Big| \big(\max(f) - \min(f) \big) - \big(\max(g) - \min(g) \big) \Big| or, in normalized form .. math:: \mathrm{RD_N}(f, g) = \frac{ \Big| \big(\max(f) - \min(f) \big) - \big(\max(g) - \min(g) \big) \Big|}{ \big(\max(f) - \min(f) \big) + \big(\max(g) - \min(g) \big)} The normalized variant takes values in :math:`[0, 1]`. """

    data = np.asarray(data)
    ground_truth = np.asarray(ground_truth)

    if mask is not None:
        mask = np.asarray(mask, dtype=bool)
        data = data[mask]
        ground_truth = ground_truth[mask]

    data_range = np.ptp(data)
    ground_truth_range = np.ptp(ground_truth)
    fom = np.abs(data_range - ground_truth_range)

    if normalized:
        denom = np.abs(data_range + ground_truth_range)
        if denom == 0:
            fom = 0.0
        else:
            fom /= denom

    return fom