code: def generate_set_partitions(set_):
      
      set_ = scipy.asarray(set_)
      strings = generate_set_partition_strings(len(set_))
      partitions = []
      for string in strings:
          blocks = []
          for block_num in scipy.unique(string):
              blocks.append(set_[string == block_num])
          partitions.append(blocks)
      
      return partitions
docs: Generate all of the partitions of a set.
      
      This is a helper function that utilizes the restricted growth strings from
      :py:func:`generate_set_partition_strings`. The partitions are returned in
      lexicographic order.
      
      Parameters
      ----------
      set_ : :py:class:`Array` or other Array-like, (`m`,)
          The set to find the partitions of.
      
      Returns
      -------
      partitions : list of lists of :py:class:`Array`
          The number of elements in the outer list is equal to the number of
          partitions, which is the len(`m`)^th Bell number. Each of the inner lists
          corresponds to a single possible partition. The length of an inner list
          is therefore equal to the number of blocks. Each of the arrays in an
          inner list is hence a block.