<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def changed_locations(a, include_first):
 """ Compute indices of values in ``a`` that differ from the previous value. Parameters a : np.ndarray The array on which to indices of change. include_first : bool Whether or not to consider the first index of the array as "changed". Example ------- array([2, 4]) array([0, 2, 4]) """

    if a.ndim > 1:
        raise ValueError("indices_of_changed_values only supports 1D arrays.")
    indices = flatnonzero(diff(a)) + 1

    if not include_first:
        return indices

    return hstack([[0], indices])