<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def all_partitions(indices):
 """Return a list of all possible coarse grains of a network. Args: indices (tuple[int]):
 The micro indices to partition. Yields: tuple[tuple]: A possible partition. Each element of the tuple is a tuple of micro-elements which correspond to macro-elements. """

    n = len(indices)
    partitions = _partitions_list(n)
    if n > 0:
        partitions[-1] = [list(range(n))]

    for partition in partitions:
        yield tuple(tuple(indices[i] for i in part)
                    for part in partition)