def _calculate_step_sizes(x_size, y_size, num_chunks):
    """
    Calculate the strides in x and y to achieve at least
    the ``num_chunks`` pieces.

    Parameters
    ----------
    """
    xstep = max(1, int(x_size / num_chunks))
    x_chunks = int(x_size / xstep)
    if x_chunks >= num_chunks:
        ystep = y_size
    else:
        y_chunks = int(num_chunks / x_chunks) + 1
        ystep = max(1, int(y_size / y_chunks))
    return xstep, ystep
