def sort_dict(od, d):
 if isinstance(od, dict):
  ret = Struct()
  for k in od.keys():
   v = d.get(k)
   if (v is not None):
    if isinstance(v, dict):
     v = sort_dict(od[k], v)
    elif isinstance(v, list):
     v = [sort_dict(od[k][0], v1) for v1 in v]
    ret[k] = v
  if hasattr(od, u'namespaces'):
   ret.namespaces.update(od.namespaces)
   ret.references.update(od.references)
   ret.qualified = od.qualified
  return ret
 else:
  return d

def sort_dict ( od , d ) : if isinstance ( od , dict ) : ret = Struct ( ) for k in od . keys ( ) : v = d . get ( k ) if ( v is not None ) : if isinstance ( v , dict ) : v = sort_dict ( od [ k ] , v ) elif isinstance ( v , list ) : v = [ sort_dict ( od [ k ] [ 0 ] , v1 ) for v1 in v ] ret [ k ] = v if hasattr ( od , u'namespaces' ) : ret . namespaces . update ( od . namespaces ) ret . references . update ( od . references ) ret . qualified = od . qualified return ret else : return d
sort parameters .