'Generates a new partition object.
This method also verifies if the arguments passed are
valid and raises a ValueError if they are not.
Examples
>>> from sympy.combinatorics.partitions import Partition
>>> a = Partition([1, 2], [3])
>>> a
{{3}, {1, 2}}
>>> a.partition
[[1, 2], [3]]
>>> len(a)
2
>>> a.members
(1, 2, 3)'

def __new__(cls, *partition):

    args = partition
    if (not all((isinstance(part, (list, FiniteSet)) for part in args))):
        raise ValueError('Each    argument    to    Partition    should    be    a    list    or    a    FiniteSet')
    partition = sorted(sum(partition, []), key=default_sort_key)
    if has_dups(partition):
        raise ValueError('Partition    contained    duplicated    elements.')
    obj = FiniteSet.__new__(cls, *[FiniteSet(*x) for x in args])
    obj.members = tuple(partition)
    obj.size = len(partition)
    return obj
