def _escape_character(m):
    """Replaces a single character with its escape sequence.

    Args:
        m (re.MatchObject): A match object whose first group is the single
            character to replace

    Returns:
        str
    """
    c = m.group(1)
    if c == "\\":
        return "\\\\"
    elif c == "\"":
        return "\\\""
    elif c == "\n":
        return "\\n"
    return c