code: def split_keras_model(model, layer):
      """Splits the keras model around layer into two models.
  
      This is done such that model2(model1(X)) = model(X)
      and mode11(X) == layer(X)
      """
  
      if isinstance(layer, str):
          layer = model.get_layer(layer)
      elif isinstance(layer, int):
          layer = model.layers[layer]
  
      prev_layer = model.get_layer(
          layer.get_input_at(0).name.split("/")[0]
      )
  
      model1 = clone_keras_layers(model, model.layers[1], prev_layer)
      model2 = clone_keras_layers(model, layer, model.layers[-1])
  
      return model1, model2
  
label_desc: Use image node_id 2 for calling a global function with example usage: split_keras_model(model, layer) and returns: model1,  model2