code: def retrieve_logs(room, start_date=None, end_date=None):
      
      from indico_chat.plugin import ChatPlugin
  
      base_url = ChatPlugin.settings.get('log_url')
      if not base_url or room.custom_server:
          return None
  
      params = {'cr': room.jid}
      if start_date:
          params['sdate'] = start_date.strftime('%Y-%m-%d')
      if end_date:
          params['edate'] = end_date.strftime('%Y-%m-%d')
  
      try:
          response = requests.get(base_url, params=params)
      except RequestException:
          current_plugin.logger.exception('Could not retrieve logs for %s', room.jid)
          return None
      if response.headers.get('content-type') == 'application/json':
          current_plugin.logger.warning('Could not retrieve logs for %s: %s', room.jid, response.json().get('error'))
          return None
      return response.text
docs: Retrieves chat logs
  
      :param room: the `Chatroom`
      :param start_date: the earliest date to get logs for
      :param end_date: the latest date to get logs for
      :return: logs in html format