def replace_case(utt):
    """Replace some tokens in utterance case by case.

    Args:
        utt (str): The utterance.

    Returns:
        str: The utterance after processing.
    """    
    utt = f" {utt} "
    case_map = {
        " a. m. ": " am ",
        " p. m. ": " pm ",
        " a. m ": " am ",
        " p. m ": " pm ",
        " a m ": " am ",
        " p m ": " pm ",
        " a rm ": " am ",
        " p rm ": " pm ",
        " s. f. ": " sf ",
        " s. w. hotel ": " sw hotel ",
        "'": " '"
    }
    ordered_keys = sorted(case_map.keys(), key=lambda x: -len(x))
    for k in ordered_keys:
        utt = utt.replace(k, case_map[k])
    return utt