<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def list_features(ctx, dataset, reverse, start, limit, output):
 """Get features of a dataset. Prints the features of the dataset as a GeoJSON feature collection. $ mapbox datasets list-features dataset-id All endpoints require authentication. An access token with `datasets:read` scope is required, see `mapbox --help`. """


    stdout = click.open_file(output, 'w')
    service = ctx.obj.get('service')
    res = service.list_features(dataset, reverse, start, limit)

    if res.status_code == 200:
        click.echo(res.text, file=stdout)
    else:
        raise MapboxCLIException(res.text.strip())