def is_file_included(filename, model):
    """
    Determines if a file is included by a model. Also checks
    for indirect inclusions (files included by included files).

    Args:
        filename: the file to be checked (filename is normalized)
        model: the owning model

    Returns:
        True if the file is included, else False
        (Note: if no _tx_model_repository is present,
        the function always returns False)
    """
    if (hasattr(model, "_tx_model_repository")):
        all_entries = model._tx_model_repository.all_models
        return all_entries.has_model(filename)
    else:
        return False