code: def auto_apply_encoders(
      X: np.ndarray,
      encoder_map: Dict[int, Union[OneHotEncoder, CatBoostEncoder]],
      Y: Optional[np.ndarray] = None,
  ) -> np.ndarray:
      X = shape_into_2d(X)
  
      if not encoder_map:
          return X
  
      if isinstance(list(encoder_map.values())[0], OneHotEncoder):
          return apply_one_hot_encoding(X, encoder_map)
      else:
          return apply_catboost_encoding(X, encoder_map, Y)
  
imports: import random
  from typing import Dict, Optional, Union
  import numpy
  from scipy.optimize import minimize
  from sklearn.preprocessing import OneHotEncoder
  from dowhy.gcm.util.catboost_encoder import CatBoostEncoder
label_desc: Use image node_id 4 for calling a global function with example usage: auto_apply_encoders(X, encoder_map, Y) and returns: X, apply_one_hot_encoding, apply_catboost_encoding