def do_event_get(mc, args):
    """Get specific event."""
    fields = {'event_id': args.id}
    try:
        event = mc.events.get(**fields)
    except exc.HTTPException as he:
        raise exc.CommandError(
            'HTTPException code=%s message=%s' %
            (he.code, he.message))
    if args.json:
        print(utils.json_formatter(event))
        return
    cols = ['id', 'description', 'generated', 'data']
    formatters = {
        'id': lambda x: x['id'],
        'description': lambda x: x['description'],
        'generated': lambda x: x['generated'],
        'data': lambda x: utils.format_dict(x['data'])
    }
    utils.print_list(event, cols, formatters=formatters)
def do_event_list(mc, args):
    """Show list of events."""
    fields = {}
    if args.limit:
        fields['limit'] = args.limit
    if args.offset:
        fields['offset'] = args.offset
    try:
        events = mc.events.list(**fields)
    except exc.HTTPException as he:
        raise exc.CommandError(
            'HTTPException code=%s message=%s' %
            (he.code, he.message))
    if args.json:
        print(utils.json_formatter(events))
        return
    cols = ['id', 'description', 'generated', 'data']
    formatters = {
        'id': lambda x: x['id'],
        'description': lambda x: x['description'],
        'generated': lambda x: x['generated'],
        'data': lambda x: utils.format_dict(x['data'])
    }
    utils.print_list(events, cols, formatters=formatters)