def check_output_format(expected_formats):
    """
    Decorator for stream outputs that checks the format of the outputs after modifiers have been applied
    :param expected_formats: The expected output formats
    :type expected_formats: tuple, set
    :return: the decorator
    """
    def output_format_decorator(func):
        def func_wrapper(*args, **kwargs):
            self = args[0]
            if self.output_format not in expected_formats:
                raise ValueError("expected output format {}, got {}".format('doc_gen', self.output_format))
            return func(*args, **kwargs)
        return func_wrapper
    return output_format_decorator