def _flatten_units_collection(items):
 if (not isinstance(items, list)):
  items = [items]
 result = set()
 for item in items:
  if isinstance(item, UnitBase):
   result.add(item)
  else:
   if isinstance(item, dict):
    units = item.values()
   elif inspect.ismodule(item):
    units = vars(item).values()
   elif isiterable(item):
    units = item
   else:
    continue
   for unit in units:
    if isinstance(unit, UnitBase):
     result.add(unit)
 return result

def _flatten_units_collection ( items ) : if ( not isinstance ( items , list ) ) : items = [ items ] result = set ( ) for item in items : if isinstance ( item , UnitBase ) : result . add ( item ) else : if isinstance ( item , dict ) : units = item . values ( ) elif inspect . ismodule ( item ) : units = vars ( item ) . values ( ) elif isiterable ( item ) : units = item else : continue for unit in units : if isinstance ( unit , UnitBase ) : result . add ( unit ) return result
given a list of sequences .