code: def file_type_validator(
      valid_file_types: List[Text], error_message: Text
  ) -> Type["Validator"]:
      """Creates a `Validator` class which can be used with `questionary` to validate
      file paths.
      """
  
      def is_valid(path: Text) -> bool:
          return path is not None and any(
              [
                  path.endswith(file_type)
                  for file_type in valid_file_types
              ]
          )
  
      return create_validator(is_valid, error_message)
  
imports: import asyncio
  import filecmp
  import logging
  import os
  import pickle
  import tempfile
  import warnings
  import re
  from asyncio import AbstractEventLoop
  from pathlib import Path
  from typing import Text, Any, Union, List, Type, Callable, TYPE_CHECKING, Pattern
  from typing_extensions import Protocol
  import rasa.shared.constants
  import rasa.shared.utils.io
label_desc: Use image node_id 8 for calling a global function with example usage: file_type_validator(valid_file_types, error_message) and returns: create_validator, unknown