def collect(self, *keys, **kwargs):
if not keys:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>has_values = functools.reduce(<EOL>operator.__and__, [key in self.data for key in keys], True<EOL>)<EOL>if has_values:<EOL><INDENT>values = tuple([self.data[key] for key in keys])<EOL>if len(values) == <NUM_LIT:1>:<EOL><INDENT>values = values[<NUM_LIT:0>]<EOL><DEDENT>if kwargs.get('<STR_LIT>', False):<EOL><INDENT>yield self.path, values<EOL><DEDENT>else:<EOL><INDENT>yield values<EOL><DEDENT><DEDENT>if kwargs.get('<STR_LIT>', True):<EOL><INDENT>for child in self.children.values():<EOL><INDENT>for value in child.collect(*keys, **kwargs):<EOL><INDENT>yield value<EOL><DEDENT><DEDENT><DEDENT>
Generator function traversing
        tree structure to collect values of a specified key.

        :param keys: the keys to look for in the report
        :type key: str
        :keyword recursive: look for key in children nodes
        :type recursive: bool
        :keyword with_path: whether the yield values is a tuple
        of 2 elements containing report-path and the value
        or simply the value.
        :type with_path: bool

        :rtype: generator providing either values or
        tuples of 2 elements containing report path and value
        depending on with_path parameter