code: def prepare_request(self, request):
          
          cookies = request.cookies or {}
  
          # Bootstrap CookieJar.
          if not isinstance(cookies, cookielib.CookieJar):
              cookies = cookiejar_from_dict(cookies)
  
          # Merge with session cookies
          merged_cookies = merge_cookies(
              merge_cookies(RequestsCookieJar(), self.cookies), cookies)
  
          # Set environment's basic authentication if not explicitly set.
          auth = request.auth
          if self.trust_env and not auth and not self.auth:
              auth = get_netrc_auth(request.url)
  
          p = PreparedRequest()
          p.prepare(
              method=request.method.upper(),
              url=request.url,
              files=request.files,
              data=request.data,
              json=request.json,
              headers=merge_setting(request.headers, self.headers, dict_class=CaseInsensitiveDict),
              params=merge_setting(request.params, self.params),
              auth=merge_setting(auth, self.auth),
              cookies=merged_cookies,
              hooks=merge_hooks(request.hooks, self.hooks),
          )
          return p
docs: Constructs a :class:`PreparedRequest <PreparedRequest>` for
          transmission and returns it. The :class:`PreparedRequest` has settings
          merged from the :class:`Request <Request>` instance and those of the
          :class:`Session`.
  
          :param request: :class:`Request` instance to prepare with this
              session's settings.
          :rtype: requests.PreparedRequest