def METHOD_NAME(path):
    try:
        indexed_fasta = IndexedFasta(path)
    except OSError as e:
        raise CommandLineError(f"Error while opening FASTA reference file: {e}")
    except FastaNotIndexedError as e:
        raise CommandLineError(
            f"An index file (.fai) for the reference FASTA '{e.args[0]}' "
            "could not be found. Please create one with "
            "'samtools faidx'."
        )
    return indexed_fasta