def write_yaml_report(func):
@wraps(func)<EOL>def _wrapper(*args, **kwargs):<EOL><INDENT>now = datetime.datetime.now()<EOL>with Timer() as timer:<EOL><INDENT>data = func(*args, **kwargs)<EOL>if isinstance(data, (SEQUENCES, types.GeneratorType)):<EOL><INDENT>report = dict(children=list(map(str, data)))<EOL><DEDENT>elif isinstance(data, MAPPINGS):<EOL><INDENT>report = data<EOL><DEDENT>else:<EOL><INDENT>raise Exception('<STR_LIT>', type(data))<EOL><DEDENT><DEDENT>report['<STR_LIT>'] = timer.elapsed<EOL>report['<STR_LIT:date>'] = now.isoformat()<EOL>if "<STR_LIT>" not in kwargs and report is not None:<EOL><INDENT>with open(YAML_REPORT_FILE, '<STR_LIT:w>') as ostr:<EOL><INDENT>yaml.dump(report, ostr, default_flow_style=False)<EOL><DEDENT><DEDENT>return report<EOL><DEDENT>return _wrapper<EOL>
Decorator used in campaign node post-processing