def count_visitors(iterable):

    """
    Finds max_visitors, and corresponding interval.
    Sort all the times entries per type and time.
    Iterate over the sorted List and
    1- increase counter multipleVisitors if the type of the time_interval is a
        "enterTime" (in). Check if the maxVisitor is gt or eq to the maxVisitor counter.
         If gt : update maxVisitor with current multipleVisitors counter.
    2- decrease counter multipleVisitors if  the type of the time_interval is a
        "exitTime" (out)  and update the low bound timeInterval

    Args:
      iterable: iterable to analyze.

    return:
      dictionary: dictionary with information regarding max number of visitors and corresponding time interval .

    """

    #sort the list of visitor in time and type (of O(nlogn))
    count_visitors_list = sorted(list(iterable), key=lambda v: (v.time(), v.time_type))
    # counting the museum visitors
    visitors, max_visitors = 0, 0
    time_interval = {}
    new_time_interval = True
    for visitor_info in count_visitors_list:
        if visitor_info.time_type == 'in_time':
            visitors += 1
            if visitors >= max_visitors:
                if visitors > max_visitors:
                    max_visitors = visitors
                time_interval.update({'in': visitor_info.time()})
                new_time_interval = False
        elif visitor_info.time_type == 'out_time':
            visitors -= 1
            if not new_time_interval:
                time_interval.update({'out': visitor_info.time()})
            new_time_interval = True

    return {'in': time_interval['in'], 'out': time_interval['out'],
            'max_visitors': max_visitors}