code: def _flatten(cls, arr) -> List[float]:
          
          if isinstance(arr, cls.SCALAR_ACTION_TYPES):
              arr = [float(arr)]
          if isinstance(arr, np.ndarray):
              arr = arr.tolist()
          if len(arr) == 0:
              return arr
          if isinstance(arr[0], np.ndarray):
              arr = [item for sublist in arr for item in sublist.tolist()]
          if isinstance(arr[0], list):
              arr = [item for sublist in arr for item in sublist]
          arr = [float(x) for x in arr]
          return arr
docs: Converts arrays to list.
          :param arr: numpy vector.
          :return: flattened list.