def METHOD_NAME(
    path: Union[str, Path],
    file_format: str,
) -> Any:
    if file_format == SerializationFormats.PICKLE:
        val = None
        try:
            with open(path, 'rb') as f:
                val = pickle.load(f)
        except Exception:
            model_load_err = ('ERROR-LOADING-EXPLAINER: '
                              'There was an error loading the explainer. '
                              'Some of RAI dashboard features may not work.')
            warnings.warn(model_load_err, UserWarning)
        return val
    elif file_format == SerializationFormats.JSON:
        with open(path, 'r') as f:
            return json.load(f)
    elif file_format == SerializationFormats.TEXT:
        with open(path, 'r') as f:
            return f.read()
    else:
        raise ValueError(f"Invalid format {file_format}")