def size(default_chunk_size, response_time_max, response_time_actual):
    """Determines the chunk size based on response times."""
    if response_time_actual == 0:
        response_time_actual = 1
    scale = 1 / (response_time_actual / response_time_max)
    size = int(default_chunk_size * scale)
    return min(max(size, 1), default_chunk_size)
Determines the chunk size based on response times.