code: 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
      -------
      >>> import numpy as np
      >>> changed_locations(np.array([0, 0, 5, 5, 1, 1]), include_first=False)
      array([2, 4])
  
      >>> changed_locations(np.array([0, 0, 5, 5, 1, 1]), include_first=True)
      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])
  
imports: from collections import OrderedDict
  from datetime import datetime
  from distutils.version import StrictVersion
  from warnings import catch_warnings, filterwarnings
  import six
  import numpy
  from numpy import array_equal, broadcast, busday_count, datetime64, diff, dtype, empty, flatnonzero, hstack, isnan, nan, vectorize, where
  from numpy.lib.stride_tricks import as_strided
  from toolz import flip
label_desc: Use image node_id 17 for calling a global function with example usage: changed_locations(a, include_first) and returns: hstack, indices