def GenerateGroupPolicyTemplateAdml(apps):
    'Generates a Group Policy template (ADML format)for the specified apps.\n\n  Replaces LF in strings above with CRLF as required by gpedit.msc.\n  When writing the resulting contents to a file, use binary mode to ensure the\n  CRLFs are preserved.\n\n  Args:\n    apps: A list of tuples containing information about each app.\n        Each element of the list is a tuple of:\n          * app name\n          * app ID\n          * optional string to append to the auto-update explanation\n            - Should start with a space or double new line.\n\n  Returns:\n    String containing the contents of the .ADML file.\n  '
    string_definition_list = ADML_PREDEFINED_STRINGS_TABLE_EN[:]
    for app in apps:
        app_name = app[0]
        app_legal_id = _CreateLegalIdentifier(app_name)
        app_additional_help_msg = app[2]
        rollback_disclaimer = app[3]
        if (not rollback_disclaimer):
            rollback_disclaimer = ADML_DEFAULT_ROLLBACK_DISCLAIMER
        app_category = (('Cat_' + app_legal_id), app_name)
        string_definition_list.append(app_category)
        app_install_policy_explanation = (('Explain_Install' + app_legal_id), ('Specifies whether %s can be installed using Google Update/Google Installer.\n\nIf this policy is not configured, %s can be installed as specified by "Allow installation default".\n\n%s' % (app_name, app_name, ADML_DOMAIN_REQUIREMENT_EN)))
        string_definition_list.append(app_install_policy_explanation)
        app_auto_update_policy_explanation = (('Explain_AutoUpdate' + app_legal_id), ('Specifies how Google Update handles available %s updates from Google.\n\nIf this policy is not configured, Google Update handles available updates as specified by "Update policy override default".\n\nOptions:\n - Always allow updates: Updates are always applied when found, either by periodic update check or by a manual update check.\n - Manual updates only: Updates are only applied when the user does a manual update check. (Not all apps provide an interface  for this.)\n - Automatic silent updates only: Updates are only applied when they are found via the periodic update check.\n - Updates disabled: Never apply updates.\n\nIf you select manual updates, you should periodically check for updates using the application\'s manual update mechanism if available. If you disable updates, you should periodically check for updates and distribute them to users.%s\n\n%s' % (app_name, app_additional_help_msg, ADML_DOMAIN_REQUIREMENT_EN)))
        string_definition_list.append(app_auto_update_policy_explanation)
        app_target_version_prefix_explanation = (('Explain_TargetVersionPrefix' + app_legal_id), ('Specifies which version %s should be updated to.\n\nWhen this policy is enabled, the app will be updated to the version prefixed with this policy value.\n\nSome examples:\n1) Not configured: app will be updated to the latest version available.\n2) Policy value is set to "55.": the app will be updated to any minor version of 55 (e.g., 55.24.34 or 55.60.2).\n3) Policy value is "55.2.": the app will be updated to any minor version of 55.2 (e.g., 55.2.34 or 55.2.2).\n4) Policy value is "55.24.34": the app will be updated to this specific version only.\n\n%s' % (app_name, ADML_DOMAIN_REQUIREMENT_EN)))
        string_definition_list.append(app_target_version_prefix_explanation)
        app_rollback_to_target_version_explanation = (('Explain_RollbackToTargetVersion' + app_legal_id), ('Specifies that Google Update should roll installations of %s back to the version indicated by "Target version prefix override".\n\nThis policy setting has no effect unless "Target version prefix override" is set.\n\nIf this policy is not configured or is disabled, installs that have a version higher than that specified by "Target version prefix override" will be left as-is.\n\nIf this policy is enabled, installs that have a version higher than that specified by "Target version prefix override" will be downgraded to the highest available version that matches the target version.\n\n%s\n\n%s' % (app_name, rollback_disclaimer, ADML_DOMAIN_REQUIREMENT_EN)))
        string_definition_list.append(app_rollback_to_target_version_explanation)
    app_resource_strings = []
    for entry in string_definition_list:
        app_resource_strings.append(('      <string id="%s">%s</string>' % (entry[0], entry[1])))
    app_resource_tables = (ADML_RESOURCE_TABLE_TEMPLATE % ('\n'.join(app_resource_strings), ADML_PRESENTATIONS))
    target_contents = [ADML_HEADER, ADML_ENVIRONMENT, app_resource_tables, ADML_FOOTER]
    return ''.join(target_contents)
Generates a Group Policy template (ADML format)for the specified apps.

Replaces LF in strings above with CRLF as required by gpedit.msc.
When writing the resulting contents to a file, use binary mode to ensure the
CRLFs are preserved.

Args:
  apps: A list of tuples containing information about each app.
      Each element of the list is a tuple of:
        * app name
        * app ID
        * optional string to append to the auto-update explanation
          - Should start with a space or double new line.

Returns:
  String containing the contents of the .ADML file.
def GenerateGroupPolicyTemplateAdml(apps):
    'Generates a Group Policy template (ADML format)for the specified apps.\n\n  Replaces LF in strings above with CRLF as required by gpedit.msc.\n  When writing the resulting contents to a file, use binary mode to ensure the\n  CRLFs are preserved.\n\n  Args:\n    apps: A list of tuples containing information about each app.\n        Each element of the list is a tuple of:\n          * app name\n          * app ID\n          * optional string to append to the auto-update explanation\n            - Should start with a space or double new line.\n\n  Returns:\n    String containing the contents of the .ADML file.\n  '
    string_definition_list = ADML_PREDEFINED_STRINGS_TABLE_EN[:]
    for app in apps:
        app_name = app[0]
        app_legal_id = _CreateLegalIdentifier(app_name)
        app_additional_help_msg = app[2]
        rollback_disclaimer = app[3]
        if (not rollback_disclaimer):
            rollback_disclaimer = ADML_DEFAULT_ROLLBACK_DISCLAIMER
        app_category = (('Cat_' + app_legal_id), app_name)
        string_definition_list.append(app_category)
        app_install_policy_explanation = (('Explain_Install' + app_legal_id), ('Specifies whether %s can be installed using Google Update/Google Installer.\n\nIf this policy is not configured, %s can be installed as specified by "Allow installation default".\n\n%s' % (app_name, app_name, ADML_DOMAIN_REQUIREMENT_EN)))
        string_definition_list.append(app_install_policy_explanation)
        app_auto_update_policy_explanation = (('Explain_AutoUpdate' + app_legal_id), ('Specifies how Google Update handles available %s updates from Google.\n\nIf this policy is not configured, Google Update handles available updates as specified by "Update policy override default".\n\nOptions:\n - Always allow updates: Updates are always applied when found, either by periodic update check or by a manual update check.\n - Manual updates only: Updates are only applied when the user does a manual update check. (Not all apps provide an interface  for this.)\n - Automatic silent updates only: Updates are only applied when they are found via the periodic update check.\n - Updates disabled: Never apply updates.\n\nIf you select manual updates, you should periodically check for updates using the application\'s manual update mechanism if available. If you disable updates, you should periodically check for updates and distribute them to users.%s\n\n%s' % (app_name, app_additional_help_msg, ADML_DOMAIN_REQUIREMENT_EN)))
        string_definition_list.append(app_auto_update_policy_explanation)
        app_target_version_prefix_explanation = (('Explain_TargetVersionPrefix' + app_legal_id), ('Specifies which version %s should be updated to.\n\nWhen this policy is enabled, the app will be updated to the version prefixed with this policy value.\n\nSome examples:\n1) Not configured: app will be updated to the latest version available.\n2) Policy value is set to "55.": the app will be updated to any minor version of 55 (e.g., 55.24.34 or 55.60.2).\n3) Policy value is "55.2.": the app will be updated to any minor version of 55.2 (e.g., 55.2.34 or 55.2.2).\n4) Policy value is "55.24.34": the app will be updated to this specific version only.\n\n%s' % (app_name, ADML_DOMAIN_REQUIREMENT_EN)))
        string_definition_list.append(app_target_version_prefix_explanation)
        app_rollback_to_target_version_explanation = (('Explain_RollbackToTargetVersion' + app_legal_id), ('Specifies that Google Update should roll installations of %s back to the version indicated by "Target version prefix override".\n\nThis policy setting has no effect unless "Target version prefix override" is set.\n\nIf this policy is not configured or is disabled, installs that have a version higher than that specified by "Target version prefix override" will be left as-is.\n\nIf this policy is enabled, installs that have a version higher than that specified by "Target version prefix override" will be downgraded to the highest available version that matches the target version.\n\n%s\n\n%s' % (app_name, rollback_disclaimer, ADML_DOMAIN_REQUIREMENT_EN)))
        string_definition_list.append(app_rollback_to_target_version_explanation)
    app_resource_strings = []
    for entry in string_definition_list:
        app_resource_strings.append(('      <string id="%s">%s</string>' % (entry[0], entry[1])))
    app_resource_tables = (ADML_RESOURCE_TABLE_TEMPLATE % ('\n'.join(app_resource_strings), ADML_PRESENTATIONS))
    target_contents = [ADML_HEADER, ADML_ENVIRONMENT, app_resource_tables, ADML_FOOTER]
    return .join(target_contents)