def interleave_offsets(batch_size: int, nu: int):
    """
    Method computing offsets that are used to interleave batches in MixMatch.
    Parameters
    ----------

    Returns
    -------
    offsets: List
        List of length (nu+1), which specifies offsets used for interleaving batches. For example, offsets in MixMatch
        are of length 4 and in the default confguration are given by [0, 21, 42, 64].
    """
    groups = [batch_size // (nu + 1)] * (nu + 1)
    for x in range(batch_size - sum(groups)):
        groups[-x - 1] += 1
    offsets = [0]
    for g in groups:
        offsets.append(offsets[-1] + g)
    assert offsets[-1] == batch_size
    return offsets