def METHOD_NAME( nnodes, gridsizes, min_blocksizes=None, mpi=None, try_uniform=False, mpi_dims_mask=None ):
    """
    With the aim of distributing a multi-dimensional array on a Cartesian
    topology, compute the number of processes along each dimension.
    Whenever possible, the number of processes is chosen so that the array is
    decomposed into identical blocks.
    Parameters
    ----------
    nnodes : int
        Number of processes in the Cartesian topology.
    gridsizes : list of int
        Number of array elements along each dimension.
    min_blocksizes : list of int
        Minimum acceptable size of a block along each dimension. 
    try_uniform: bool
        try to decompose the array uniformly.
    mpi_dims_mask: list of bool
        True if the dimension is to be used in the domain decomposition (=default for each dimension). 
        If dim_mask[i]=False, the domain decomposition yields blocksizes[i]=gridsizes[i] along the i-th dimension.
    Returns
    -------
    dims : list of int
        Number of processes along each dimension of the Cartesian topology. 
    blocksizes : list of int
        Nominal block size along each dimension.
    """
    assert nnodes > 0
    assert all( s > 0 for s in gridsizes )
    assert np.prod( gridsizes ) >= nnodes
    if (min_blocksizes is not None):
        assert len( min_blocksizes ) == len( gridsizes )
        assert all( m > 0 for m in gridsizes )
        assert all( s >= m for s,m in zip( gridsizes, min_blocksizes ) )
    # Determine whether uniform decomposition is possible
    uniform = (np.prod( gridsizes ) % nnodes == 0)
    # Compute dimensions of MPI Cartesian topology with most appropriate algorithm
    if try_uniform and uniform:
        dims, blocksizes = compute_dims_uniform( nnodes, gridsizes )
    else:
        dims, blocksizes = compute_dims_general( nnodes, gridsizes, mpi_dims_mask=mpi_dims_mask )
    # If a minimum block size is given, verify that condition is met
    if min_blocksizes is not None:
        too_small = any( [s < m for (s,m) in zip( blocksizes, min_blocksizes )] )
        # If uniform decomposition yields blocks too small, fall back to general algorithm
        if uniform and too_small:
            dims, blocksizes = compute_dims_general( nnodes, gridsizes )
            too_small = any( [s < m for (s,m) in zip( blocksizes, min_blocksizes )] )
        # If general decomposition yields blocks too small, raise error
        if too_small:
            raise ValueError("Cannot compute dimensions with the minimum acceptable block sizes {}".format(tuple(min_blocksizes)))
    return dims, blocksizes