<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def build_news(ctx, draft=False, yes=False):
 """ Build towncrier newsfragments. """


    report.info(ctx, "docs.build-news", "building changelog from news fragments")
    build_command = f"towncrier --version {ctx.metadata['version']}"
    if draft:
        report.warn(
            ctx,
            "docs.build-news",
            "building changelog as draft (results are written to stdout)",
        )
        build_command += " --draft"
    elif yes:
        report.warn(
            ctx, "docs.build-news", "removing news files without user confirmation (-y)"
        )
        build_command += " --yes"
    ctx.run(build_command, hide=None)