def escaped_length(line: str) -> int:
    """The length of the string after performing the necessary escapes.

    Assumes that backslashes and quotes are escaped, and the string is
    surrounded with quotes."""
    # +2 for surrounding quotes, rest is for normal escapes.
    return len(line) + 2 + line.count(r'"') + line.count('\\')