docs: def _lookup_admin_template(policy_name,
                             policy_class,
                             adml_language='en-US'):
      '''
      (success_flag, policy_xml_item, policy_name_list, message)
      '''
      policy_aliases = []
      admx_policy_definitions = _get_policy_definitions(language=adml_language)
      adml_policy_resources = _get_policy_resources(language=adml_language)
      admx_search_results = ADMX_SEARCH_XPATH(admx_policy_definitions,
                                              policy_name=policy_name,
                                              registry_class=policy_class)
      if admx_search_results:
          if len(admx_search_results) == 1:
              the_policy = admx_search_results[0]
              policy_display_name = _getFullPolicyName(
                      policy_item=the_policy,
                      policy_name=the_policy.attrib['name'],
                      return_full_policy_names=True,
                      adml_language=adml_language)
              policy_aliases.append(policy_display_name)
              policy_aliases.append(the_policy.attrib['name'])
              full_path_list = _build_parent_list(policy_definition=the_policy,
                                                  return_full_policy_names=True,
                                                  adml_language=adml_language)
              full_path_list.reverse()
              full_path_list.append(policy_display_name)
              policy_aliases.append('\\'.join(full_path_list))
              return True, the_policy, policy_aliases, None
          else:
              msg = 'ADMX policy name/id "{0}" is used in multiple ADMX files'
              return False, None, [], msg
      else:
          adml_search_results = ADML_SEARCH_XPATH(adml_policy_resources,
                                                  policy_name=policy_name)
          hierarchy = []
          hierarchy_policy_name = policy_name
          if not adml_search_results:
              if '\\' in policy_name:
                  hierarchy = policy_name.split('\\')
                  policy_name = hierarchy.pop()
                  adml_search_results = ADML_SEARCH_XPATH(adml_policy_resources,
                                                          policy_name=policy_name)
          if adml_search_results:
              multiple_adml_entries = False
              suggested_policies = ''
              adml_to_remove = []
              if len(adml_search_results) > 1:
                  log.debug('multiple ADML entries found matching the policy name %s', policy_name)
                  multiple_adml_entries = True
                  for adml_search_result in adml_search_results:
                      if not getattr(adml_search_result, 'text', '').strip() == policy_name:
                          adml_to_remove.append(adml_search_result)
                      else:
                          if hierarchy:
                              log.debug('we have hierarchy of %s', hierarchy)
                              display_name_searchval = '$({0}.{1})'.format(
                                      adml_search_result.tag.split('}')[1],
                                      adml_search_result.attrib['id'])
                              #policy_search_string = '//{0}:policy[@*[local-name() = "displayName"] = "{1}" and (@*[local-name() = "class"] = "Both" or @*[local-name() = "class"] = "{2}") ]'.format(
                              policy_search_string = '//{0}:policy[@displayName = "{1}" and (@class = "Both" or @class = "{2}") ]'.format(
                                  adml_search_result.prefix,
                                  display_name_searchval,
                                  policy_class)
                              admx_results = []
                              these_admx_search_results = admx_policy_definitions.xpath(policy_search_string, namespaces=adml_search_result.nsmap)
                              if not these_admx_search_results:
                                  log.debug('No admx was found for the adml entry %s, it will be removed', display_name_searchval)
                                  adml_to_remove.append(adml_search_result)
                              for search_result in these_admx_search_results:
                                  log.debug('policy_name == %s', policy_name)
                                  this_hierarchy = _build_parent_list(
                                      policy_definition=search_result,
                                      return_full_policy_names=True,
                                      adml_language=adml_language)
                                  this_hierarchy.reverse()
                                  if hierarchy != this_hierarchy:
                                      msg = 'hierarchy %s does not match this item\'s hierarchy of %s'
                                      log.debug(msg, hierarchy, this_hierarchy)
                                      if len(these_admx_search_results) == 1:
                                          log.debug('only 1 admx was found and it does not match this adml, it is safe to remove from the list')
                                          adml_to_remove.append(adml_search_result)
                                  else:
                                      log.debug('hierarchy %s matches item\'s hierarchy of %s', hierarchy, this_hierarchy)
                                      log.debug('search_result %s added to results', search_result)
                                      admx_results.append(search_result)
                              if len(admx_results) == 1:
                                  admx_search_results.append(admx_results[0])
                          else:
                              # verify the ADMX correlated to this ADML is in the same class
                              # that we are looking for
                              display_name_searchval = '$({0}.{1})'.format(
                                      adml_search_result.tag.split('}')[1],
                                      adml_search_result.attrib['id'])
                              these_admx_search_results = ADMX_DISPLAYNAME_SEARCH_XPATH(
                                      admx_policy_definitions,
                                      display_name=display_name_searchval,
                                      registry_class=policy_class)
                              if not these_admx_search_results:
                                  adml_to_remove.append(adml_search_result)
              for adml in adml_to_remove:
                  if adml in adml_search_results:
                      adml_search_results.remove(adml)
              if len(adml_search_results) == 1 and multiple_adml_entries:
                  multiple_adml_entries = False
              for adml_search_result in adml_search_results:
                  log.debug('found an ADML entry matching the string! %s -- %s',
                            adml_search_result.tag,
                            adml_search_result.attrib)
                  display_name_searchval = '$({0}.{1})'.format(
                          adml_search_result.tag.split('}')[1],
                          adml_search_result.attrib['id'])
                  log.debug('searching for displayName == %s', display_name_searchval)
                  if not admx_search_results:
                      log.debug('search for an admx entry matching display_name %s and registry_class %s', display_name_searchval, policy_class)
                      admx_search_results = ADMX_DISPLAYNAME_SEARCH_XPATH(
                              admx_policy_definitions,
                              display_name=display_name_searchval,
                              registry_class=policy_class)
                  if admx_search_results:
                      log.debug('processing admx_search_results of %s', admx_search_results)
                      log.debug('multiple_adml_entries is %s', multiple_adml_entries)
                      if (len(admx_search_results) == 1 or hierarchy) and not multiple_adml_entries:
                          found = False
                          for search_result in admx_search_results:
                              found = False
                              if hierarchy:
                                  this_hierarchy = _build_parent_list(
                                      policy_definition=search_result,
                                      return_full_policy_names=True,
                                      adml_language=adml_language)
                                  this_hierarchy.reverse()
                                  log.debug('testing %s == %s', hierarchy, this_hierarchy)
                                  if hierarchy == this_hierarchy:
                                      found = True
                              else:
                                  found = True
                              if found:
                                  log.debug('found the ADMX policy matching '
                                            'the display name %s -- %s',
                                            search_result, policy_name)
                                  if 'name' in search_result.attrib:
                                      policy_display_name = _getFullPolicyName(
                                          policy_item=search_result,
                                          policy_name=search_result.attrib['name'],
                                          return_full_policy_names=True,
                                          adml_language=adml_language)
                                      policy_aliases.append(policy_display_name)
                                      policy_aliases.append(search_result.attrib['name'])
                                      full_path_list = _build_parent_list(
                                          policy_definition=search_result,
                                          return_full_policy_names=True,
                                          adml_language=adml_language)
                                      full_path_list.reverse()
                                      full_path_list.append(policy_display_name)
                                      policy_aliases.append('\\'.join(full_path_list))
                                      return True, search_result, policy_aliases, None
                                  else:
                                      msg = ('ADMX policy with the display name {0} does not'
                                             'have the required name attribtue')
                                      msg = msg.format(policy_name)
                                      return False, None, [], msg
                          if not found:
                              msg = 'Unable to correlate {0} to any policy'.format(hierarchy_policy_name)
                              return False, None, [], msg
                      else:
                          for possible_policy in admx_search_results:
                              this_parent_list = _build_parent_list(
                                  policy_definition=possible_policy,
                                  return_full_policy_names=True,
                                  adml_language=adml_language)
                              this_parent_list.reverse()
                              this_parent_list.append(policy_name)
                              if suggested_policies:
                                  suggested_policies = ', '.join([suggested_policies,
                                                                 '\\'.join(this_parent_list)])
                              else:
                                  suggested_policies = '\\'.join(this_parent_list)
              if suggested_policies:
                  msg = ('ADML policy name "{0}" is used as the display name'
                         ' for multiple policies.'
                         '  These policies matched: {1}'
                         '.  You can utilize these long names to'
                         ' specify the correct policy')
                  return False, None, [], \
                         msg.format(policy_name, suggested_policies)
      return False, None, [], \
             'Unable to find {0} policy {1}'.format(policy_class, policy_name)