def deactivate_user(query):
    """
    Deactivate a user.
    """
    user = _query_to_user(query)
    if click.confirm(f'Are you sure you want to deactivate {user!r}?'):
        user.active = False
        user_manager.save(user, commit=True)
        click.echo(f'Successfully deactivated {user!r}')
    else:
        click.echo('Cancelled.')