def halve_date_range(self, threats_date_filter):
        """
        We want to halve the date range if the current one returns too many threats to avoid timeouts on the orchestration. 
        """
        try:
            gte_datetime_str = threats_date_filter['gte_datetime']
            lte_datetime_str = threats_date_filter['lte_datetime']
            gte_datetime = datetime.strptime(gte_datetime_str, TIME_FORMAT)
            lte_datetime = datetime.strptime(lte_datetime_str, TIME_FORMAT)
            midpoint_datetime = gte_datetime + (lte_datetime - gte_datetime) / 2
            midpoint_datetime_str = midpoint_datetime.strftime(TIME_FORMAT)
            threats_date_filter['lte_datetime'] = midpoint_datetime_str 
            logging.warning(f"Halved date range, too many results. New date range is {gte_datetime_str} - {midpoint_datetime_str}")
        except Exception as e:
            logging.error(f"Failed to halve date range: {e}")
        return threats_date_filter

        We want to halve the date range if the current one returns too many threats to avoid timeouts on the orchestration. 
        
Solutions/AbnormalSecurity/Data Connectors/SentinelFunctionsOrchestrator/soar_connector_async.py