code: def partition(partition):
      
      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)
docs: Validate a partition - used by blackboxes and coarse grains.