def _toset(thing):
 if (thing is None):
  return set()
 if isinstance(thing, six.string_types):
  return set((thing,))
 try:
  return set((str(x) for x in thing))
 except TypeError:
  return set((str(thing),))

def _toset ( thing ) : if ( thing is None ) : return set ( ) if isinstance ( thing , six . string_types ) : return set ( ( thing , ) ) try : return set ( ( str ( x ) for x in thing ) ) except TypeError : return set ( ( str ( thing ) , ) )
helper to convert various things to a set this enables flexibility in what users provide as the list of ldap entry attribute values .