import copy
import warnings


def defCol(name: str, typ: str, *coll_sets):
    """
    Legacy utility method for simplifying trust sets.

    >>> actual = defCol("a", "INTEGER", [1], [2], [1, 2, 3])
    >>> expected = ("a", "INTEGER", {1, 2, 3})
    >>> actual == expected
    True

    >>> actual = defCol("a", "INTEGER", 1, 2, 3)
    >>> expected = ("a", "INTEGER", {1, 2, 3})
    >>> actual == expected
    True

    >>> actual = defCol("a", "INTEGER", 1)
    >>> expected = ("a", "INTEGER", {1})
    >>> actual == expected
    True
    """

    if not coll_sets:
        trust_set = set()
    else:
        first_set = coll_sets[0]
        trust_set = copy.copy({first_set} if isinstance(first_set, int) else set(first_set))
        for ts in coll_sets[1:]:
            if isinstance(ts, int):
                ts_set = {ts}
            else:
                warnings.warn("Use of lists for trust sets is deprecated")
                ts_set = set(ts)
            trust_set |= ts_set
    return name, typ, trust_set