# Buggy code
def _groupby_dict_reduce(
    self, by, axis, agg_func, agg_args, agg_kwargs, groupby_kwargs, drop=False
):
    map_dict = {}
    reduce_dict = {}
    rename_columns = any(
        not isinstance(fn, str) and isinstance(fn, Iterable) for fn in agg_func.values()
    )
    for col, col_funcs in agg_func.items():
        if not rename_columns:
            map_dict[col], reduce_dict[col] = groupby_reduce_functions[col_funcs]
            continue

        if isinstance(col_funcs, str):
            col_funcs = [col_funcs]

        map_fns = []
        for i, fn in enumerate(col_funcs):
            if not isinstance(fn, str) and isinstance(fn, Iterable):
                new_col_name, func = fn
            elif isinstance(fn, str):
                new_col_name, func = fn, fn
            else:
                raise TypeError

            map_fns.append((new_col_name, groupby_reduce_functions[func][0]))
            reduce_dict[(col, new_col_name)] = groupby_reduce_functions[func][1]
        map_dict[col] = map_fns
    return GroupbyReduceFunction.register(map_dict, reduce_dict)(
        query_compiler=self,
        by=by,
        axis=axis,
        groupby_args=groupby_kwargs,
        map_args=agg_kwargs,
        reduce_args=agg_kwargs,
        numeric_only=False,
        drop=drop,
    )


# Traceback (AssertionError)
Traceback (most recent call last):
File "../rofl.py", line 18, in <module>
df_equals(md_res, pd_res)
File "/localdisk/dchigare/repos/modin_bp/modin/pandas/test/utils.py", line 527, in df_equals
check_categorical=False,
File "/localdisk/dchigare/miniconda3/envs/modin_tests/lib/python3.7/site-packages/pandas/_testing.py", line 1562, in assert_frame_equal
obj, f"{obj} shape mismatch", f"{repr(left.shape)}", f"{repr(right.shape)}",
File "/localdisk/dchigare/miniconda3/envs/modin_tests/lib/python3.7/site-packages/pandas/_testing.py", line 1036, in raise_assert_detail
raise AssertionError(msg)
AssertionError: DataFrame are different

DataFrame shape mismatch
[left]:  (251, 2)
[right]: (251, 4)

# Fixed code
def _groupby_dict_reduce(
    self, by, axis, agg_func, agg_args, agg_kwargs, groupby_kwargs, drop=False
):
    map_dict = {}
    reduce_dict = {}
    rename_columns = any(
        not isinstance(fn, str) and isinstance(fn, Iterable) for fn in agg_func.values()
    )
    for col, col_funcs in agg_func.items():
        if not rename_columns:
            map_dict[col], reduce_dict[col] = groupby_reduce_functions[col_funcs]
            continue

        if isinstance(col_funcs, str):
            col_funcs = [col_funcs]

        map_fns = []
        for i, fn in enumerate(col_funcs):
            if not isinstance(fn, str) and isinstance(fn, Iterable):
                new_col_name, func = fn
            elif isinstance(fn, str):
                new_col_name, func = fn, fn
            else:
                raise TypeError

            map_fns.append((new_col_name, groupby_reduce_functions[func][0]))
            reduced_col_name = (
                (*col, new_col_name) if isinstance(col, tuple) else (col, new_col_name)
            )
            reduce_dict[reduced_col_name] = groupby_reduce_functions[func][1]
        map_dict[col] = map_fns
    return GroupbyReduceFunction.register(map_dict, reduce_dict)(
        query_compiler=self,
        by=by,
        axis=axis,
        groupby_args=groupby_kwargs,
        map_args=agg_kwargs,
        reduce_args=agg_kwargs,
        numeric_only=False,
        drop=drop,
    )