def METHOD_NAME(checkpoint_path, prefix="", skip_regex=None):
    """Returns scaffold function to restore parameters from v1 checkpoint.
    Args:
      checkpoint_path: path of the checkpoint folder or file.
        Example 1: '/path/to/model_dir/'
        Example 2: '/path/to/model.ckpt-22500'
      prefix: prefix in the variable name to be remove for alignment with names in
        the checkpoint.
      skip_regex: regular expression to math the names of variables that do not
        need to be assign.
    Returns:
      Callable[tf.kears.Model] -> void. Fn to load v1 checkpoint to keras model.
    """
    def _restore_checkpoint_fn(keras_model):
        """Loads pretrained model through scaffold function."""
        if not checkpoint_path:
            logger.info("checkpoint_path is empty")
            return
        var_prefix = prefix
        if prefix and not prefix.endswith("/"):
            var_prefix += "/"
        var_to_shape_map = _get_checkpoint_map(checkpoint_path)
        assert var_to_shape_map, "var_to_shape_map should not be empty"
        vars_to_load = _build_assignment_map(
            keras_model, prefix=var_prefix, skip_variables_regex=skip_regex, var_to_shape_map=var_to_shape_map
        )
        if not vars_to_load:
            raise ValueError("Variables to load is empty.")
        tf.compat.v1.train.init_from_checkpoint(checkpoint_path, vars_to_load)
    return _restore_checkpoint_fn