code: def test_rebalance_by_categorical():
      result1 = rebalance_by_categorical(data1, "col1").sort_values(
          by="col1"
      )
  
      expected1 = pd.DataFrame(
          {
              "col1": ["a", "a", "b", "b", "c", "c"],
          }
      )
  
      assert result1.reset_index(drop=True).equals(
          expected1
      ), "not working with non numeric column"
  
      result2 = rebalance_by_categorical(
          data2, "col2", max_lines_by_categ=2
      ).sort_values(by="col2")
  
      expected2 = pd.DataFrame(
          {
              "col2": [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],
          }
      )
  
      assert result2.reset_index(drop=True).equals(
          expected2
      ), "not working with numeric columns"
  
label_desc: Use image node_id 1 for calling a global function with example usage: test_rebalance_by_categorical() without return types