code: def revoke_admin():
      
      build = g.build
      form = forms.RemoveAdminForm()
      if form.validate_on_submit():
          user = models.User.query.get(form.user_id.data)
          if not user:
              logging.debug('User being revoked admin access does not exist.'
                            'id=%r, build_id=%r', form.user_id.data, build.id)
              abort(400)
  
          if user == current_user:
              logging.debug('User trying to remove themself as admin. '
                            'id=%r, build_id=%r', user.id, build.id)
              abort(400)
  
          db.session.add(build)
          db.session.add(user)
          db.session.refresh(build, lockmode='update')
          db.session.refresh(user, lockmode='update')
  
          user_is_owner = build.owners.filter_by(id=user.id)
          if not user_is_owner:
              logging.debug('User being revoked admin access is not owner. '
                            'id=%r, build_id=%r.', user.id, build.id)
              abort(400)
  
          build.owners.remove(user)
          save_admin_log(build, revoked_admin=True, message=user.email_address)
  
          db.session.commit()
  
          operations.UserOps(user.get_id()).evict()
  
      return redirect(url_for('manage_admins', build_id=build.id))
docs: Form submission handler for revoking admin access to a build.