code: def detect_and_swap_bert_model(
      model, data_type, lib_path=default_lib_path, remove_padding=False
  ):
      if type(model) == HFBertModel:
          model = swap_model(model, data_type, lib_path, remove_padding)
      if hasattr(model, "bert") and type(model.bert) == HFBertModel:
          model.bert = swap_model(
              model.bert, data_type, lib_path, remove_padding
          )
      return model
  
file_path: nebuly/optimization/nebullvm/nebullvm/operations/optimizations/compilers/faster_transformer/bert/__init__.py
imports: import os
  from nebullvm.operations.optimizations.compilers.faster_transformer.bert.modeling_bert import BertModel
  from nebullvm.operations.optimizations.compilers.faster_transformer.bert.modeling_bert import CustomEncoder, EncoderWeights
  from nebullvm.operations.optimizations.compilers.utils import get_faster_transformer_repo_path
  from nebullvm.optional_modules.huggingface import BertModel
  from nebullvm.optional_modules.torch import torch
label_desc: Use image node_id 3 for calling a global function with example usage: detect_and_swap_bert_model(model, data_type, lib_path, remove_padding) and returns: model