code: def add_package(self, pkg, action_type="Install"):
          
          if isinstance(pkg, Package):
              if action_type not in ("Install", "Cache", "Install Cached"):
                  raise ValueError
              package = self.add_object_to_path(
                  pkg, "package_configuration/packages")
              # If there's already an action specified, get it, then
              # overwrite. Otherwise, make a new subelement.
              action = package.find("action")
              if not action:
                  action = ElementTree.SubElement(package, "action")
              action.text = action_type
          else:
              raise ValueError("Please pass a Package object to parameter: "
                               "pkg.")
docs: Add a Package object to the policy with action=install.
  
          Args:
              pkg: A Package object to add.
              action_type (str, optional): One of "Install", "Cache", or
                  "Install Cached".  Defaults to "Install".