code: def change_email(*_, user_id=None, new_email=None):
      
      click.echo(green('\nChange email:'))
      click.echo(green('-' * 40))
  
      with get_app().app_context():
          user = find_user(dict(id=user_id))
          if not user:
              click.echo(red('User not found\n'))
              return
  
          user.email = new_email
          result = user_service.save(user)
          if not isinstance(result, User):
              print_validation_errors(result)
              return
  
          user.confirm_email()
          user_service.save(user)
          msg = 'Change email for user {} to {} \n'
          click.echo(green(msg.format(user.email, new_email)))
docs: Change email for a user