def ordered_collection(coll_id, total, page, data):
    collection = {'@context': context}
    collection_page = {'id': f'{coll_id}?page={page}', 'partOf': coll_id, 'totalItems': len(data), 'type': 'OrderedCollectionPage', 'orderedItems': data}
    if data:
        collection['next'] = f'{coll_id}?page={(page + 1)}'
    if total:
        collection.update({'id': coll_id, 'totalItems': total, 'type': 'OrderedCollection'})
        if data:
            collection['first'] = collection_page
    else:
        collection.update(collection_page)
    return collection
def ordered_collection(coll_id, total, page, data):
    collection = {'@context': context}
    collection_page = {'id': f'{coll_id}?page={page}', 'partOf': coll_id, 'totalItems': len(data), 'type': 'OrderedCollectionPage', 'orderedItems': data}
    if data:
        collection['next'] = f'{coll_id}?page={(page + 1)}'
    if total:
        collection.update({'id': coll_id, 'totalItems': total, 'type': 'OrderedCollection'})
        if data:
            collection['first'] = collection_page
    else:
        collection.update(collection_page)
    return collection