docs: def _sort_by(self, datum, param, path=None):
          """
          Key function that is used for results sorting. This is passed as argument to `sorted()`
          """
          if not path:
              path = []
          try:
              if '__' in param:
                  root, new_param = param.split('__')
                  path.append(root)
                  return self._sort_by(datum[root], param=new_param, path=path)
              else:
                  path.append(param)
  
              data = datum[param]
              if isinstance(data, list):
                  raise ValidationError(self._list_attribute_error.format(param))
              return data
          except TypeError:
              raise ValidationError(self._list_attribute_error.format('.'.join(path)))
          except KeyError:
              raise ValidationError('Invalid sorting field: {}'.format('.'.join(path)))