<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _add_algorithm_defaults(algorithm, analysis, is_cwl):
 """Central location specifying defaults for algorithm inputs. Converts allowed multiple inputs into lists if specified as a single item. Converts required single items into string if specified as a list """

    if not algorithm:
        algorithm = {}
    defaults = {"archive": None,
                "tools_off": [],
                "tools_on": [],
                "qc": [],
                "trim_reads": False,
                "adapters": [],
                "effects": "snpeff",
                "quality_format": "standard",
                "expression_caller": ["salmon"] if analysis.lower().find("rna-seq") >= 0 else None,
                "align_split_size": None,
                "bam_clean": False,
                "nomap_split_size": 250,
                "nomap_split_targets": _get_nomap_split_targets(analysis, is_cwl),
                "mark_duplicates": False if not algorithm.get("aligner") else True,
                "coverage_interval": None,
                "min_allele_fraction": 10.0,
                "recalibrate": False,
                "realign": False,
                "ensemble": None,
                "exclude_regions": [],
                "variant_regions": None,
                "svcaller": [],
                "svvalidate": None,
                "svprioritize": None,
                "validate": None,
                "validate_regions": None,
                "vcfanno": []}
    convert_to_list = set(["tools_off", "tools_on", "hetcaller", "variantcaller", "svcaller", "qc", "disambiguate",
                           "vcfanno", "adapters", "custom_trim", "exclude_regions"])
    convert_to_single = set(["hlacaller", "indelcaller", "validate_method"])
    for k, v in defaults.items():
        if k not in algorithm:
            algorithm[k] = v
    for k, v in algorithm.items():
        if k in convert_to_list:
            if v and not isinstance(v, (list, tuple)) and not isinstance(v, dict):
                algorithm[k] = [v]
            # ensure dictionary specified inputs get converted into individual lists
            elif v and not isinstance(v, (list, tuple)) and isinstance(v, dict):
                new = {}
                for innerk, innerv in v.items():
                    if innerv and not isinstance(innerv, (list, tuple)) and not isinstance(innerv, dict):
                        innerv = [innerv]
                    new[innerk] = innerv
                algorithm[k] = new
            elif v is None:
                algorithm[k] = []
        elif k in convert_to_single:
            if v and not isinstance(v, six.string_types):
                if isinstance(v, (list, tuple)) and len(v) == 1:
                    algorithm[k] = v[0]
                else:
                    raise ValueError("Unexpected input in sample YAML; need a single item for %s: %s" % (k, v))
    return algorithm