<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def fake_index(in_bam, data):
 """Create a fake index file for namesorted BAMs. bais require by CWL for consistency. """

    index_file = "%s.bai" % in_bam
    if not utils.file_exists(index_file):
        with file_transaction(data, index_file) as tx_out_file:
            with open(tx_out_file, "w") as out_handle:
                out_handle.write("name sorted -- no index")
    return index_file