<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fasta_idx(in_file, config=None):
 """Retrieve samtools style fasta index. """

    fasta_index = in_file + ".fai"
    if not utils.file_exists(fasta_index):
        samtools = config_utils.get_program("samtools", config) if config else "samtools"
        cmd = "{samtools} faidx {in_file}"
        do.run(cmd.format(**locals()), "samtools faidx")
    return fasta_index