def unescape(literal: str) -> str:
    """Evaluate Python escape sequences in a string, e.g. ``r"\n"`` to ``"\n"``"""
    # see https://stackoverflow.com/a/57192592/5349916
    return literal.encode("latin-1", "backslashreplace").decode("unicode-escape")