<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete(ctx, query, force):
 """ Delete a credential. Delete a credential from your YubiKey. Provide a query string to match the credential to delete. """


    ensure_validated(ctx)
    controller = ctx.obj['controller']
    creds = controller.list()
    hits = _search(creds, query)
    if len(hits) == 0:
        click.echo('No matches, nothing to be done.')
    elif len(hits) == 1:
        cred = hits[0]
        if force or (click.confirm(
                u'Delete credential: {} ?'.format(cred.printable_key),
                default=False, err=True
        )):
            controller.delete(cred)
            click.echo(u'Deleted {}.'.format(cred.printable_key))
        else:
            click.echo('Deletion aborted by user.')

    else:
        _error_multiple_hits(ctx, hits)