Very simple aber convient-enough conversion from baxter MCH to IPA MCH.
    this is also more or less already implemented in MiddleChinese

def baxter2ipa(mch, segmented=False):
    """
    Very simple aber convient-enough conversion from baxter MCH to IPA MCH.
    this is also more or less already implemented in MiddleChinese
    """

    out = mch
    if out[-1] in 'ptk':
        out += 'R'
    elif out[-1] not in 'XHP':
        out += 'P'
        
    for s,t in _cd.GY['ipa']: 
        out = out.replace(s,t)
    if segmented:
        return parse_chinese_morphemes(out) 
    return out