code: def _rescale(vector):
      
      # Subtract min, making smallest value 0
      min_val = min(vector)
      vector = [v - min_val for v in vector]
  
      # Divide by max, making largest value 1
      max_val = float(max(vector))
      try:
          return [v / max_val for v in vector]
      except ZeroDivisionError:  # All values are the same
          return [1.0] * len(vector)
docs: Scale values in vector to the range [0, 1].
  
      Args:
          vector: A list of real values.