def get_substr_slices(umi_length, idx_size):
    """
    Create slices to split a UMI into approximately equal size substrings
    Returns a list of tuples that can be passed to slice function.
    """
    cs, r = divmod(umi_length, idx_size)
    sub_sizes = [cs + 1] * r + [cs] * (idx_size - r)
    offset = 0
    slices = []
    for s in sub_sizes:
        slices.append((offset, offset + s))
        offset += s
    return slices