code: def nunique(expr):
      
      output_type = types.int64
  
      if isinstance(expr, SequenceExpr):
          return NUnique(_value_type=output_type, _inputs=[expr])
      elif isinstance(expr, SequenceGroupBy):
          return GroupedNUnique(_data_type=output_type, _inputs=[expr.to_column()], _grouped=expr.input)
      elif isinstance(expr, CollectionExpr):
          unique_input = _extract_unique_input(expr)
          if unique_input:
              return nunique(unique_input)
          else:
              return NUnique(_value_type=types.int64, _inputs=expr._project_fields)
      elif isinstance(expr, GroupBy):
          if expr._to_agg:
              inputs = expr.input[expr._to_agg.names]._project_fields
          else:
              inputs = expr.input._project_fields
          return GroupedNUnique(_data_type=types.int64, _inputs=inputs,
                                _grouped=expr)
docs: The distinct count.
  
      :param expr:
      :return: