<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def run(data):
 """HLA typing with bwakit, parsing output from called genotype files. """

    bwakit_dir = os.path.dirname(os.path.realpath(utils.which("run-bwamem")))
    hla_fqs = tz.get_in(["hla", "fastq"], data, [])
    if len(hla_fqs) > 0:
        hla_base = os.path.commonprefix(hla_fqs)
        while hla_base.endswith("."):
            hla_base = hla_base[:-1]
        out_file = hla_base + ".top"
        if not utils.file_exists(out_file):
            cmd = "{bwakit_dir}/run-HLA {hla_base}"
            do.run(cmd.format(**locals()), "HLA typing with bwakit")
            out_file = _organize_calls(out_file, hla_base, data)
        data["hla"].update({"call_file": out_file,
                            "hlacaller": "bwakit"})
    return data