code: def groupcountdistinctvalues(table, key, value):
      
      
      s1 = cut(table, key, value)
      s2 = distinct(s1)
      s3 = aggregate(s2, key, len)
      return s3
docs: Group by the `key` field then count the number of distinct values in the
      `value` field.