+def d_from_l(l, key):
+ d = {}
+ for obj in l:
+ if not str(obj[key]) in d:
+ d[str(obj[key])] = obj
+ else:
+ print "Two objects have the same %s key %s!" % (key, obj[key])
+ continue
+ return d
+
+def dpcus_from_lpcus(l_pcus):
+ d_pcus = d_from_l(l_pcus, 'pcu_id')
+ return d_pcus
+
+def dnodes_from_lnodes(l_nodes):
+ d_nodes = d_from_l(l_nodes, 'hostname')
+ return d_nodes
+