<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def partition(partition):
 """Validate a partition - used by blackboxes and coarse grains."""

    nodes = set()
    for part in partition:
        for node in part:
            if node in nodes:
                raise ValueError(
                    'Micro-element {} may not be partitioned into multiple '
                    'macro-elements'.format(node))
            nodes.add(node)