def get_csrf_token(response):
cookie_headers = [<EOL>h.decode('<STR_LIT:ascii>') for h in response.headers.getlist("<STR_LIT>")<EOL>]<EOL>if not cookie_headers:<EOL><INDENT>return None<EOL><DEDENT>csrf_headers = [<EOL>h for h in cookie_headers if h.startswith("<STR_LIT>")<EOL>]<EOL>if not csrf_headers:<EOL><INDENT>return None<EOL><DEDENT>match = re.match("<STR_LIT>", csrf_headers[-<NUM_LIT:1>])<EOL>return match.group(<NUM_LIT:1>)<EOL>
Extract the CSRF token out of the "Set-Cookie" header of a response.