def METHOD_NAME(saved_model_path, trainable,
                           regularization_loss_multiplier):
  """Load a pre-trained feature extractor and wrap it for use in Keras."""
  if regularization_loss_multiplier is not None:
    # TODO(b/63257857): Scaling regularization losses requires manual loading
    # and modification of the SavedModel
    obj = tf.saved_model.load(saved_model_path)
    def _scale_one_loss(l):  # Separate def avoids lambda capture of loop var.
      f = tf.function(lambda: tf.multiply(regularization_loss_multiplier, l()))
      _ = f.get_concrete_function()
      return f
    obj.regularization_losses = [_scale_one_loss(l)
                                 for l in obj.regularization_losses]
    # The modified object is then passed to hub.KerasLayer instead of the
    # string handle. That prevents it from saving a Keras config (b/134528831).
    handle = obj
  else:
    # If possible, we exercise the more common case of passing a string handle
    # such that hub.KerasLayer can save a Keras config (b/134528831).
    handle = saved_model_path
  arguments = {}
  if FLAGS.dropout_rate is not None:
    arguments['dropout_rate'] = FLAGS.dropout_rate
  return hub.KerasLayer(handle, trainable=trainable, arguments=arguments)