def _toset(thing):
    '''helper to convert various things to a set

    This enables flexibility in what users provide as the list of LDAP
    entry attribute values.  Note that the LDAP spec prohibits
    duplicate values in an attribute and that the order is
    unspecified, so a set is good for automatically removing
    duplicates.

    None becomes an empty set.  Iterables except for strings have
    their elements added to a new set.  Non-None scalars (strings,
    numbers, non-iterable objects, etc.) are added as the only member
    of a new set.

    '''
    if thing is None:
        return set()
    if isinstance(thing, six.string_types):
        return set((thing,))
    # convert numbers to strings so that equality checks work
    # (LDAP stores numbers as strings)
    try:
        return set((str(x) for x in thing))
    except __HOLE__:
        return set((str(thing),))
dataset/ETHPy150Open saltstack/salt/salt/states/ldap.py/_toset