def shaping_dim(array, ndim):
    """The dimensions of the array have to be least than ndim.

    Parameters
    ----------
    array: np.ndarray
        the array we want to format with the shape dimensions required.
    ndim: int
        the shape dimensions we want to format the input.

    Returns
    -------
    array: np.ndarray
        the array formatted in the shape dimensions required in the input.

    """

    if array.ndim >= ndim:
        return array
    dim_extend = ndim - array.ndim
    newshape = tuple(list(array.shape) + [1 for i in range(dim_extend)])
    array = array.reshape(newshape)
    return array