code: def test_arg_sort_sort_by_groups_update__4360() -> None:
      df = pl.DataFrame(
          {
              "group": ["a"] * 3 + ["b"] * 3 + ["c"] * 3,
              "col1": [1, 2, 3] * 3,
              "col2": [1, 2, 3, 3, 2, 1, 2, 3, 1],
          }
      )
  
      out = df.with_columns(
          pl.col("col2").arg_sort().over("group").alias("col2_arg_sort")
      ).with_columns(
          [
              pl.col("col1")
              .sort_by(pl.col("col2_arg_sort"))
              .over("group")
              .alias("result_a"),
              pl.col("col1")
              .sort_by(pl.col("col2").arg_sort())
              .over("group")
              .alias("result_b"),
          ]
      )
  
      assert_series_equal(
          out["result_a"], out["result_b"], check_names=False
      )
      assert out["result_a"].to_list() == [1, 2, 3, 3, 2, 1, 2, 3, 1]
  
imports: from __future__ import annotations
  from collections import OrderedDict
  from datetime import datetime, timedelta
  from typing import Any
  import pytest
  import polars
  from polars.testing import assert_frame_equal, assert_series_equal
label_desc: Use image node_id 14 for calling a global function with example usage: test_arg_sort_sort_by_groups_update__4360() without return types