code: def guess_format(filename: Text) -> Text:
      """Applies heuristics to guess the data format of a file.
  
      Args:
          filename: file whose type should be guessed
  
      Returns:
          Guessed file format.
      """
      from rasa.shared.nlu.training_data.formats import RasaYAMLReader
  
      guess = UNK
  
      if not os.path.isfile(filename):
          return guess
  
      try:
          content = rasa.shared.utils.io.read_file(filename)
          js = json.loads(content)
      except ValueError:
          if RasaYAMLReader.is_yaml_nlu_file(filename):
              guess = RASA_YAML
      else:
          for (
              file_format,
              format_heuristic,
          ) in _json_format_heuristics.items():
              if format_heuristic(js, filename):
                  guess = file_format
                  break
  
      logger.debug(
          f"Training data format of '{filename}' is '{guess}'."
      )
  
      return guess
  
file_path: rasa/rasa/shared/nlu/training_data/loading.py
imports: import json
  import logging
  import os
  import typing
  from typing import Optional, Text, Callable, Dict, Any, List
  import rasa.shared.utils.io
  from rasa.shared.nlu.training_data.formats.dialogflow import DIALOGFLOW_AGENT, DIALOGFLOW_ENTITIES, DIALOGFLOW_ENTITY_ENTRIES, DIALOGFLOW_INTENT, DIALOGFLOW_INTENT_EXAMPLES, DIALOGFLOW_PACKAGE
  from rasa.shared.nlu.training_data.training_data import TrainingData
label_desc: Use image node_id 4 for calling a global function with example usage: guess_format(filename) and returns: guess, guess