def stdformD(D, Cd, M, dimN=2):
    """Reshape dictionary array to internal standard form.

    Reshape dictionary array (`D` in :mod:`.admm.cbpdn` module, `X` in
    :mod:`.admm.ccmod` module) to internal standard form.

    Parameters
    ----------
    D : array_like
      Dictionary array
    Cd : int
      Size of dictionary channel index
    M : int
      Number of filters in dictionary
    dimN : int, optional (default 2)
      Number of problem spatial indices

    Returns
    -------
    Dr : ndarray
      Reshaped dictionary array
    """
    return D.reshape(D.shape[0:dimN] + (Cd,) + (1,) + (M,))
