code: def log_response(_, _request, response, *_args, **kwargs):
      # type: (Any, ClientRequest, ClientResponse, str, Any) -> Optional[ClientResponse]
      
      if not _LOGGER.isEnabledFor(logging.DEBUG):
          return None
  
      try:
          _LOGGER.debug("Response status: %r", response.status_code)
          _LOGGER.debug("Response headers:")
          for res_header, value in response.headers.items():
              _LOGGER.debug("    %r: %r", res_header, value)
  
          # We don't want to log binary data if the response is a file.
          _LOGGER.debug("Response content:")
          pattern = re.compile(r'attachment; ?filename=["\w.]+', re.IGNORECASE)
          header = response.headers.get('content-disposition')
  
          if header and pattern.match(header):
              filename = header.partition('=')[2]
              _LOGGER.debug("File attachments: %s", filename)
          elif response.headers.get("content-type", "").endswith("octet-stream"):
              _LOGGER.debug("Body contains binary data.")
          elif response.headers.get("content-type", "").startswith("image"):
              _LOGGER.debug("Body contains image data.")
          else:
              if kwargs.get('stream', False):
                  _LOGGER.debug("Body is streamable")
              else:
                  _LOGGER.debug(response.text())
          return response
      except Exception as err:  # pylint: disable=broad-except
          _LOGGER.debug("Failed to log response: %s", repr(err))
          return response
docs: Log a server response.
  
      :param _: Unused in current version (will be None)
      :param requests.Request request: The request object.
      :param requests.Response response: The response object.