def tupleize_categories(db):
    for ds in db:
        if ds.get('categories'):
            ds['categories'] = tuple(ds['categories'])
        for exc in ds.get('exchanges', []):
            if exc.get('categories'):
                exc['categories'] = tuple(exc['categories'])
    return db
def tupleize_categories(db):
    for ds in db:
        if ds.get('categories'):
            ds['categories'] = tuple(ds['categories'])
        for exc in ds.get('exchanges', []):
            if exc.get('categories'):
                exc['categories'] = tuple(exc['categories'])
    return db