<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def summary(dataset_uri, format):
 """Report summary information about a dataset."""

    dataset = dtoolcore.DataSet.from_uri(dataset_uri)
    creator_username = dataset._admin_metadata["creator_username"]
    frozen_at = dataset._admin_metadata["frozen_at"]
    num_items = len(dataset.identifiers)
    tot_size = sum([dataset.item_properties(i)["size_in_bytes"]
                    for i in dataset.identifiers])

    if format == "json":
        json_lines = [
            '{',
            '  "name": "{}",'.format(dataset.name),
            '  "uuid": "{}",'.format(dataset.uuid),
            '  "creator_username": "{}",'.format(creator_username),
            '  "number_of_items": {},'.format(num_items),
            '  "size_in_bytes": {},'.format(tot_size),
            '  "frozen_at": {}'.format(frozen_at),
            '}',
        ]
        formatted_json = "\n".join(json_lines)
        colorful_json = pygments.highlight(
            formatted_json,
            pygments.lexers.JsonLexer(),
            pygments.formatters.TerminalFormatter())
        click.secho(colorful_json, nl=False)

    else:
        info = [
            ("name", dataset.name),
            ("uuid", dataset.uuid),
            ("creator_username", creator_username),
            ("number_of_items", str(num_items)),
            ("size", sizeof_fmt(tot_size).strip()),
            ("frozen_at", date_fmt(frozen_at)),
        ]
        for key, value in info:
            click.secho("{}: ".format(key), nl=False)
            click.secho(value, fg="green")