code: def normalise_by_negative(
      a: np.ndarray,
      normalise_axes: Optional[Sequence[int]] = None,
  ) -> np.ndarray:
      """
      Normalise attributions between [-1, 1].
  
      Parameters
      ----------
      a: np.ndarray
           the array to normalise, e.g., an image or an explanation.
      normalise_axes: optional, sequence
              the axes to normalise over.
      kwargs: optional
          Keyword arguments.
  
      Returns
      -------
      a: np.ndarray
           a normalised array.
      """
  
      # No normalisation if a is only zeros.
      if np.all(a == 0.0):
          return a
  
      # Default normalise_axes.
      if normalise_axes is None:
          normalise_axes = list(range(np.ndim(a)))
  
      # Cast Sequence to tuple so numpy accepts it.
      normalise_axes = tuple(normalise_axes)
  
      # Build return array from three cases.
      return_array = np.zeros(a.shape, dtype=a.dtype)
  
      # Calculate max and min values.
      a_max = a.max(axis=normalise_axes, keepdims=True)
      a_min = a.min(axis=normalise_axes, keepdims=True)
  
      # Case a.min() >= 0.0.
      return_array = np.where(
          a_min >= 0.0,
          np.divide(a, a_max, where=a_max != 0),
          return_array,
      )
  
      # Case a.max() <= 0.0.
      return_array = np.where(
          a_max <= 0.0,
          -np.divide(a, a_min, where=a_min != 0),
          return_array,
      )
  
      # Else.
      # TODO: Temporary solution to catch an elusive bug causing a numpy RuntimeWarning below.
      #       Will be removed once bug is fixed.
      with warnings.catch_warnings():
          warnings.filterwarnings("error")
          try:
              return_array = np.where(
                  np.logical_and(a_min < 0.0, a_max > 0.0),
                  (a > 0.0) * np.divide(a, a_max, where=a_max != 0)
                  - (a < 0.0) * np.divide(a, a_min, where=a_min != 0),
                  return_array,
              )
          except RuntimeWarning:
              print(
                  "Encountered a RuntimeWarning in numpy operation during normalise_by_negative, although both nan and inf values should be impossible here."
                  "If this occurred, please try to use a different normalisation function, e.g., normalising by maximum of unsigned array."
              )
              print(
                  "-----------------------------------------------------DEBUG OUTPUT------------------------------------------------------"
              )
              print("a_max: {}".format(a_max))
              print("a_min: {}".format(a_min))
              print(
                  "np.logical_and(a_min < 0.0, a_max > 0.0): {}".format(
                      np.logical_and(a_min < 0.0, a_max > 0.0)
                  )
              )
              print("(a > 0.0): {}".format((a > 0.0)))
              print(
                  "np.divide(a, a_max, where=a_max != 0): {}".format(
                      np.divide(a, a_max, where=a_max != 0)
                  )
              )
              print(
                  "(a > 0.0) * np.divide(a, a_max, where=a_max != 0): {}".format(
                      (a > 0.0) * np.divide(a, a_max, where=a_max != 0)
                  )
              )
              print("(a < 0.0): {}".format((a > 0.0)))
              print(
                  "np.divide(a, a_min, where=a_min != 0): {}".format(
                      np.divide(a, a_min, where=a_min != 0)
                  )
              )
              print(
                  "(a < 0.0) * np.divide(a, a_min, where=a_min != 0): {}".format(
                      (a < 0.0) * np.divide(a, a_min, where=a_min != 0)
                  )
              )
              raise
  
      return return_array
  
imports: import warnings
  from typing import Optional, Sequence
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: normalise_by_negative(a, normalise_axes) and returns: return_array, a