<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def retrieve_logs(room, start_date=None, end_date=None):
 """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 """

    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