def build_map_threaded(function: Callable[[Any], Any] = None,
                       mode=MODE.CONCURRENT, unpack: bool = False):
    """ Decorator to wrap a function to return a MapThreaded operator.

    :param function: function to be wrapped
    :param mode: behavior when a value is currently processed
    :param unpack: value from emits will be unpacked (*value)
    """
    _mode = mode

    def _build_map_threaded(function: Callable[[Any], Any]):
        @wraps(function)
        def _wrapper(*args, mode=None, **kwargs) -> MapThreaded:
            if 'unpack' in kwargs:
                raise TypeError('"unpack" has to be defined by decorator')
            if mode is None:
                mode = MODE.CONCURRENT if _mode is None else _mode
            return MapThreaded(function, *args, mode=mode, unpack=unpack,
                               **kwargs)
        return _wrapper

    if function:
        return _build_map_threaded(function)

    return _build_map_threaded
Decorator to wrap a function to return a MapThreaded operator.

    :param function: function to be wrapped
    :param mode: behavior when a value is currently processed
    :param unpack: value from emits will be unpacked (*value)