code: def lwp_cookie_str(cookie):
      
      h = [(cookie.name, cookie.value),
           ("path", cookie.path),
           ("domain", cookie.domain)]
      if cookie.port is not None: h.append(("port", cookie.port))
      if cookie.path_specified: h.append(("path_spec", None))
      if cookie.port_specified: h.append(("port_spec", None))
      if cookie.domain_initial_dot: h.append(("domain_dot", None))
      if cookie.secure: h.append(("secure", None))
      if cookie.expires: h.append(("expires",
                                 time2isoz(float(cookie.expires))))
      if cookie.discard: h.append(("discard", None))
      if cookie.comment: h.append(("comment", cookie.comment))
      if cookie.comment_url: h.append(("commenturl", cookie.comment_url))
  
      keys = sorted(cookie._rest.keys())
      for k in keys:
          h.append((k, str(cookie._rest[k])))
  
      h.append(("version", str(cookie.version)))
  
      return join_header_words([h])
docs: Return string representation of Cookie in an the LWP cookie file format.
  
      Actually, the format is extended a bit -- see module docstring.