def METHOD_NAME(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