code: def get_sort_on(allowed_indexes=None):
      sort_on = get("sort_on")
      if allowed_indexes and sort_on not in allowed_indexes:
          logger.warn("Index '{}' is not in allowed_indexes".format(sort_on))
          return None
      return sort_on