code: def OrderFields(fields):
      
      fields = list(fields)
  
      @use_context
      @use_raw_input
      def _OrderFields(context, row):
          nonlocal fields
          context.setdefault("remaining", None)
          if not context.output_type:
              context.remaining = list(sorted(set(context.get_input_fields()) - set(fields)))
              context.set_output_fields(fields + context.remaining)
  
          yield tuple(row.get(field) for field in context.get_output_fields())
  
      return _OrderFields
docs: Transformation factory to reorder fields in a data stream.
  
      :param fields:
      :return: callable