def _admx_policy_parent_walk(path, policy_namespace, parent_category, policy_nsmap, admx_policy_definitions, return_full_policy_names, adml_policy_resources):
 category_xpath_string = '/policyDefinitions/categories/{0}:category[@name="{1}"]'
 using_xpath_string = '/policyDefinitions/policyNamespaces/{0}:using'
 if (parent_category.find(':') >= 0):
  policy_namespace = parent_category.split(':')[0]
  parent_category = parent_category.split(':')[1]
  using_xpath_string = using_xpath_string.format(policy_namespace)
  policy_nsmap = dictupdate.update(policy_nsmap, _buildElementNsmap(admx_policy_definitions.xpath(using_xpath_string, namespaces=policy_nsmap)))
 category_xpath_string = category_xpath_string.format(policy_namespace, parent_category)
 if admx_policy_definitions.xpath(category_xpath_string, namespaces=policy_nsmap):
  tparent_category = admx_policy_definitions.xpath(category_xpath_string, namespaces=policy_nsmap)[0]
  this_parent_name = _getFullPolicyName(tparent_category, tparent_category.attrib['name'], return_full_policy_names, adml_policy_resources)
  path.append(this_parent_name)
  if tparent_category.xpath('{0}:parentCategory/@ref'.format(policy_namespace), namespaces=policy_nsmap):
   path = _admx_policy_parent_walk(path, policy_namespace, tparent_category.xpath('{0}:parentCategory/@ref'.format(policy_namespace), namespaces=policy_nsmap)[0], policy_nsmap, admx_policy_definitions, return_full_policy_names, adml_policy_resources)
 return path

def _admx_policy_parent_walk ( path , policy_namespace , parent_category , policy_nsmap , admx_policy_definitions , return_full_policy_names , adml_policy_resources ) : category_xpath_string = '/policyDefinitions/categories/{0}:category[@name="{1}"]' using_xpath_string = '/policyDefinitions/policyNamespaces/{0}:using' if ( parent_category . find ( ':' ) >= 0 ) : policy_namespace = parent_category . split ( ':' ) [ 0 ] parent_category = parent_category . split ( ':' ) [ 1 ] using_xpath_string = using_xpath_string . format ( policy_namespace ) policy_nsmap = dictupdate . update ( policy_nsmap , _buildElementNsmap ( admx_policy_definitions . xpath ( using_xpath_string , namespaces = policy_nsmap ) ) ) category_xpath_string = category_xpath_string . format ( policy_namespace , parent_category ) if admx_policy_definitions . xpath ( category_xpath_string , namespaces = policy_nsmap ) : tparent_category = admx_policy_definitions . xpath ( category_xpath_string , namespaces = policy_nsmap ) [ 0 ] this_parent_name = _getFullPolicyName ( tparent_category , tparent_category . attrib [ 'name' ] , return_full_policy_names , adml_policy_resources ) path . append ( this_parent_name ) if tparent_category . xpath ( '{0}:parentCategory/@ref' . format ( policy_namespace ) , namespaces = policy_nsmap ) : path = _admx_policy_parent_walk ( path , policy_namespace , tparent_category . xpath ( '{0}:parentCategory/@ref' . format ( policy_namespace ) , namespaces = policy_nsmap ) [ 0 ] , policy_nsmap , admx_policy_definitions , return_full_policy_names , adml_policy_resources ) return path
helper function to recursively walk up the admx namespaces and build the hierarchy for the policy .