code: def parse_cookie(cookie):
      
      cookiedict = {}
      for chunk in cookie.split(str(';')):
          if str('=') in chunk:
              key, val = chunk.split(str('='), 1)
          else:
              # Assume an empty name per
              # https://bugzilla.mozilla.org/show_bug.cgi?id=169091
              key, val = str(''), chunk
          key, val = key.strip(), val.strip()
          if key or val:
              # unquote using Python's algorithm.
              cookiedict[key] = unquote_cookie(val)
      return cookiedict
docs: 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.