def _cast(self, _input, _output):
        """
        Transforms a pair of input/output into the real slim shoutput.

        :param _input: Bag
        :param _output: mixed
        :return: Bag
        """

        if isenvelope(_output):
            _output, _flags, _options = _output.unfold()
        else:
            _flags, _options = [], {}

        if len(_flags):
            # TODO: parse flags to check constraints are respected (like not modified alone, etc.)

            if F_NOT_MODIFIED in _flags:
                return _input

            if F_INHERIT in _flags:
                if self._output_type is None:
                    self._output_type = concat_types(
                        self._input_type, self._input_length, self._output_type, len(_output)
                    )
                _output = _input + ensure_tuple(_output)

        if not self._output_type:
            if issubclass(type(_output), tuple):
                self._output_type = type(_output)

        return ensure_tuple(_output, cls=self._output_type)
def _cast ( self , _input , _output ) : if isenvelope ( _output ) : _output , _flags , _options = _output . unfold ( ) else : _flags , _options = [ ] , { } if len ( _flags ) : if F_NOT_MODIFIED in _flags : return _input if F_INHERIT in _flags : if self . _output_type is None : self . _output_type = concat_types ( self . _input_type , self . _input_length , self . _output_type , len ( _output ) ) _output = _input + ensure_tuple ( _output ) if not self . _output_type : if issubclass ( type ( _output ) , tuple ) : self . _output_type = type ( _output ) return ensure_tuple ( _output , cls = self . _output_type )
Transforms a pair of input/output into the real slim shoutput.

        :param _input: Bag
        :param _output: mixed
        :return: Bag