def transform_whitespace(
    token: pytokens.Token, source: str, prev_token: Optional[pytokens.Token]
) -> pytokens.Token:
    r"""
    Black treats `\\\n` at the end of a line as a 'NL' token, while it
    is ignored as whitespace in the regular Python parser.
    But, only the first one. If there's a `\\\n` following it
    (as in, a \ just by itself on a line), that is not made into NL.
    """
    if (
        token.type == TokenType.whitespace
        and prev_token is not None
        and prev_token.type not in (TokenType.nl, TokenType.newline)
    ):
        token_str = source[token.start_index : token.end_index]
        if token_str.startswith("\\\r\n"):
            return pytokens.Token(
                TokenType.nl,
                token.start_index,
                token.start_index + 3,
                token.start_line,
                token.start_col,
                token.start_line,
                token.start_col + 3,
            )
        elif token_str.startswith("\\\n") or token_str.startswith("\\\r"):
            return pytokens.Token(
                TokenType.nl,
                token.start_index,
                token.start_index + 2,
                token.start_line,
                token.start_col,
                token.start_line,
                token.start_col + 2,
            )

    return token

    Black treats `\\\n` at the end of a line as a 'NL' token, while it
    is ignored as whitespace in the regular Python parser.
    But, only the first one. If there's a `\\\n` following it
    (as in, a \ just by itself on a line), that is not made into NL.
    
src/blib2to3/pgen2/tokenize.py