from typing import Any


def to_base_mut(k: str, cpg: Any = False) -> str:
    """
    convert a 3-mer mutation type into its 
    single-nucleotide mutation type

    >>> to_base_mut("ACA>ATA")
    "C>T"
    >>> to_base_mut("CCG>CTG", cpg=True)
    "CpG>TpG"
    >>> to_base_mut("ACG>ATG", cpg=False)
    "C>T"
    """

    if k == 'indel': return 'indel'

    # make sure the mutation type is a true 3-mer
    # (a 3-nucleotide reference to a 3-nucleotide alternate)
    nuc_1, nuc_2 = k.split('>')
    if not (len(nuc_1) == 3 and len(nuc_2) == 3): return 'indel'

    base = None

    # grab the middle nucleotide from either the reference
    # or alternate alleles
    mid_idx = 1
    base = nuc_1[mid_idx] + '>' + nuc_2[mid_idx]

    # special situation where mutation is CpG>TpG
    subseq_nuc = nuc_1[mid_idx + 1]
    if cpg:
        if base == "C>T" and subseq_nuc == 'G':
            base = 'CpG>TpG'

    return base