def compare_list(x, y):
   """
   Compare lists by content. Ordering does not matter.
   Returns True if both lists contain the same items (and are of identical
   length)
   """

   cmpx = [set(cluster) for cluster in x]
   cmpy = [set(cluster) for cluster in y]

   all_ok = True

   for cset in cmpx:
      all_ok &= cset in cmpy

   for cset in cmpy:
      all_ok &= cset in cmpx

   return all_ok