docs: def members(self, ref, cuts=None, order=None, page=None, page_size=None):
          """ List all the distinct members of the given reference, filtered and
          paginated. If the reference describes a dimension, all attributes are
          returned. """
          def prep(cuts, ref, order, columns=None):
              q = select(columns=columns)
              bindings = []
              cuts, q, bindings = Cuts(self).apply(q, bindings, cuts)
              fields, q, bindings = \
                  Fields(self).apply(q, bindings, ref, distinct=True)
              ordering, q, bindings = \
                  Ordering(self).apply(q, bindings, order, distinct=fields[0])
              q = self.restrict_joins(q, bindings)
              return q, bindings, cuts, fields, ordering
  
          # Count
          count = count_results(self, prep(cuts, ref, order, [1])[0])
  
          # Member list
          q, bindings, cuts, fields, ordering = prep(cuts, ref, order)
          page, q = Pagination(self).apply(q, page, page_size)
          q = self.restrict_joins(q, bindings)
          return {
              'total_member_count': count,
              'data': list(generate_results(self, q)),
              'cell': cuts,
              'fields': fields,
              'order': ordering,
              'page': page['page'],
              'page_size': page['page_size']
          }