def METHOD_NAME(form: TransferPackageForm):
	query = Package.query.filter(Package.author.has(username=form.old_username.data))
	if nonempty_or_none(form.package.data):
		query = query.filter_by(name=form.package.data)
	packages = query.all()
	if len(packages) == 0:
		flash("Unable to find package(s)", "danger")
		return
	new_user = User.query.filter_by(username=form.new_username.data).first()
	if new_user is None:
		flash("Unable to find new user", "danger")
		return
	for package in packages:
		package.author = new_user
		package.maintainers.append(new_user)
		package.aliases.append(PackageAlias(form.old_username.data, package.name))
		add_audit_log(AuditSeverity.MODERATION, current_user,
				f"Transferred {form.old_username.data}/{package.name} to {form.new_username.data}",
				package.get_url("packages.view"), package)
	db.session.commit()
	flash("Transferred " + ", ".join([x.name for x in packages]), "success")
	return redirect(url_for("admin.transfer"))