code: def atleast_n_dimensions(data: np.array, ndim: int) -> np.array:
      """
      Returns a view of the ``data` with at least ``ndim`` dimensions
  
      :param data: ndarray which dimensional size should be set to at least ``ndim``
      :param ndim: number of required axes to have in ``data``
  
      :return: ``data`` expanded from the last axis to the provided ``ndim`` size if it doesn't satisfy it
      """
      while data.ndim < ndim:
          data = np.expand_dims(data, axis=-1)
      return data
  
imports: from functools import reduce
  from typing import Optional
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: atleast_n_dimensions(data, ndim) and returns: data