def _k_mer_to_index(k_mer):
    """Converts a k-mer to its numerical index.

    Args:
        k_mer (str): The :math:`k`-mer to convert.

    Returns:
        int: The index of the :math:`k`-mer.

    Examples:
        >>> _k_mer_to_index("A")
        0
        >>> _k_mer_to_index("T")
        3
        >>> _k_mer_to_index("TT")
        15
        >>> _k_mer_to_index("TTT")
        63

    """
    result = 0
    for base in k_mer:
        result = result * 4 + ["A", "C", "G", "T"].index(base)
    return result