def _updatePolicyElements(policy_item, regkey):
 for child in policy_item.getiterator():
  if ('valueName' in child.attrib):
   if ('key' not in child.attrib):
    child.attrib['key'] = regkey
 return policy_item

def _updatePolicyElements ( policy_item , regkey ) : for child in policy_item . getiterator ( ) : if ( 'valueName' in child . attrib ) : if ( 'key' not in child . attrib ) : child . attrib [ 'key' ] = regkey return policy_item
helper function to add the reg key to each policies element definitions if the key attribute is not defined to make xpath searching easier for each child in the policy <elements> item .