def change_keys(recs, key='uuid', filter_func=None):
 new_recs = {}
 for (ref, rec) in recs.items():
  if ((filter_func is not None) and (not filter_func(rec))):
   continue
  new_recs[rec[key]] = rec
  new_recs[rec[key]]['ref'] = ref
 return new_recs

def change_keys ( recs , key = 'uuid' , filter_func = None ) : new_recs = { } for ( ref , rec ) in recs . items ( ) : if ( ( filter_func is not None ) and ( not filter_func ( rec ) ) ) : continue new_recs [ rec [ key ] ] = rec new_recs [ rec [ key ] ] [ 'ref' ] = ref return new_recs
take a xapi dict .