def paginate_results(request, search_results):
    """returns a paginated list of dict results"""
    params = parse_body(request)
    page = params['page'] - 1 if params['page'] > 0 else 0  # zero index
    MAX_RESULTS = 100
    number_per_page = min(MAX_RESULTS, params['number_per_page'])
    start = page * number_per_page
    end = start + number_per_page
    search_results = search_results[start:end]

    building_list = []
    for b in search_results:
        building_dict = b.to_dict()
        # see if a building is matched
        co_parent = b.co_parent
        if co_parent:
            building_dict['matched'] = True
            building_dict['coparent'] = co_parent.to_dict()
            child = b.children.first()
            if child:
                building_dict['confidence'] = child.confidence
        else:
            building_dict['matched'] = False

        building_list.append(building_dict)
    return building_list
dataset/ETHPy150Open buildingenergy/buildingenergy-platform/seed/search.py/paginate_results/original