code: def _sort_and_trim(data, reverse=False):
          threshold = 10
          data_list = data.items()
          data_list = sorted(
              data_list,
              key=lambda data_info: data_info[1],
              reverse=reverse,
          )
          return data_list[:threshold]