def add_restaurant(rest_dict, rest_name, rest_id, msg): restaurant = Restaurant(name=rest_name, id=rest_id) timestamp_str = msg['ts'] timestamp_int = int(float(timestamp_str)) if rest_dict.__contains__(restaurant): rest_dict[restaurant].add_time(timestamp_int) else: restaurant.add_time(timestamp_int) rest_dict[restaurant] = restaurant