def tuples_to_spans(tree):
    """
    Returns list of spans, that are (start, size).
    """

    result = []

    def helper(tr, pos=0):
        if isinstance(tr, str):
            return 1
        size = 0
        for x in tr:
            subsize = helper(x, pos=pos+size)
            size += subsize
        result.append((pos, size))
        return size

    helper(tree)

    return result