def safe_union(a, b):
 if (not isinstance(a, list)):
  raise TypeError(('Expected first argument to be a list, but got ' + str(type(a))))
 assert isinstance(b, list)
 c = []
 for x in (a + b):
  if (x not in c):
   c.append(x)
 return c

def safe_union ( a , b ) : if ( not isinstance ( a , list ) ) : raise TypeError ( ( 'Expected first argument to be a list, but got ' + str ( type ( a ) ) ) ) assert isinstance ( b , list ) c = [ ] for x in ( a + b ) : if ( x not in c ) : c . append ( x ) return c
does the logic of a union operation without the non-deterministic ordering of python sets .