def parse_cookie(cookie):
cookiedict = {}<EOL>for chunk in cookie.split(str('<STR_LIT:;>')):<EOL><INDENT>if str('<STR_LIT:=>') in chunk:<EOL><INDENT>key, val = chunk.split(str('<STR_LIT:=>'), <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>key, val = str('<STR_LIT>'), chunk<EOL><DEDENT>key, val = key.strip(), val.strip()<EOL>if key or val:<EOL><INDENT>cookiedict[key] = unquote_cookie(val)<EOL><DEDENT><DEDENT>return cookiedict<EOL>
Parse a ``Cookie`` HTTP header into a dict of name/value pairs.
    This function attempts to mimic browser cookie parsing behavior;
    it specifically does not follow any of the cookie-related RFCs
    (because browsers don't either).
    The algorithm used is identical to that used by Django version 1.9.10.