docs: def retry_using_http_NTLM_auth(self, auth_header_field, auth_header,
                                     response, auth_type, args):
          # Get the certificate of the server if using HTTPS for CBT
          server_certificate_hash = _get_server_cert(response)
  
          """Attempt to authenticate using HTTP NTLM challenge/response."""
          if auth_header in response.request.headers:
              return response
  
          content_length = int(
              response.request.headers.get('Content-Length', '0'), base=10)
          if hasattr(response.request.body, 'seek'):
              if content_length > 0:
                  response.request.body.seek(-content_length, 1)
              else:
                  response.request.body.seek(0, 0)
  
          # Consume content and release the original connection
          # to allow our new request to reuse the same one.
          response.content
          response.raw.release_conn()
          request = response.request.copy()
  
          # ntlm returns the headers as a base64 encoded bytestring. Convert to
          # a string.
          context = ntlm.Ntlm()
          negotiate_message = context.create_negotiate_message(self.domain).decode('ascii')
          auth = u'%s %s' % (auth_type, negotiate_message)
          request.headers[auth_header] = auth
  
          # A streaming response breaks authentication.
          # This can be fixed by not streaming this request, which is safe
          # because the returned response3 will still have stream=True set if
          # specified in args. In addition, we expect this request to give us a
          # challenge and not the real content, so the content will be short
          # anyway.
          args_nostream = dict(args, stream=False)
          response2 = response.connection.send(request, **args_nostream)
  
          # needed to make NTLM auth compatible with requests-2.3.0
  
          # Consume content and release the original connection
          # to allow our new request to reuse the same one.
          response2.content
          response2.raw.release_conn()
          request = response2.request.copy()
  
          # this is important for some web applications that store
          # authentication-related info in cookies (it took a long time to
          # figure out)
          if response2.headers.get('set-cookie'):
              request.headers['Cookie'] = response2.headers.get('set-cookie')
  
          # get the challenge
          auth_header_value = response2.headers[auth_header_field]
  
          auth_strip = auth_type + ' '
  
          ntlm_header_value = next(
              s for s in (val.lstrip() for val in auth_header_value.split(','))
              if s.startswith(auth_strip)
          ).strip()
  
          # Parse the challenge in the ntlm context
          context.parse_challenge_message(ntlm_header_value[len(auth_strip):])
  
          # build response
          # Get the response based on the challenge message
          authenticate_message = context.create_authenticate_message(
              self.username,
              self.password,
              self.domain,
              server_certificate_hash=server_certificate_hash
          )
          authenticate_message = authenticate_message.decode('ascii')
          auth = u'%s %s' % (auth_type, authenticate_message)
          request.headers[auth_header] = auth
  
          response3 = response2.connection.send(request, **args)
  
          # Update the history.
          response3.history.append(response)
          response3.history.append(response2)
  
          # Get the session_security object created by ntlm-auth for signing and sealing of messages
          self.session_security = context.session_security
  
          return response3