Can probably replace above with:
sort = filter_kwargs.get('sort', [('avg','DESC')])
limit = filter_kwargs.get('limit',None)

No need to delete from kwargs as they will be ignored when filtering.