<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def upgrade_thirdparty_tools(args, remotes):
 """Install and update third party tools used in the pipeline. Creates a manifest directory with installed programs on the system. """

    cbl = get_cloudbiolinux(remotes)
    if args.toolconf and os.path.exists(args.toolconf):
        package_yaml = args.toolconf
    else:
        package_yaml = os.path.join(cbl["dir"], "contrib", "flavor",
                                    "ngs_pipeline_minimal", "packages-conda.yaml")
    sys.path.insert(0, cbl["dir"])
    cbl_conda = __import__("cloudbio.package.conda", fromlist=["conda"])
    cbl_conda.install_in(_get_conda_bin(), args.tooldir, package_yaml)
    manifest_dir = os.path.join(_get_data_dir(), "manifest")
    print("Creating manifest of installed packages in %s" % manifest_dir)
    cbl_manifest = __import__("cloudbio.manifest", fromlist=["manifest"])
    if os.path.exists(manifest_dir):
        for fname in os.listdir(manifest_dir):
            if not fname.startswith("toolplus"):
                os.remove(os.path.join(manifest_dir, fname))
    cbl_manifest.create(manifest_dir, args.tooldir)