# Path: craft_ai/pandas/constants.py
# MISSING_VALUE = MissingValue()
# 
# OPTIONAL_VALUE = OptionalValue()
# 
# Path: craft_ai/constants.py
# REACT_CRAFT_AI_DECISION_TREE_VERSION = "0.0.23"
# 
# Path: craft_ai/errors.py
# class CraftAiError(Exception):
#     """Base class for exceptions in the craft ai client."""
# 
#     def __init__(self, message=None, metadata=None):
#         self.message = message
#         self.metadata = metadata
#         super(CraftAiError, self).__init__(message, metadata)
# 
#     def __str__(self):
#         return repr(self.message)


import json
import re
import string
import importlib
import pandas as pd
from random import choice
from semver import VersionInfo
from .constants import (
    MISSING_VALUE,
    OPTIONAL_VALUE,
)
from ..constants import REACT_CRAFT_AI_DECISION_TREE_VERSION
from ..errors import CraftAiError
    tree_version = tree_object.get("_version")
    if not tree_version:
        raise CraftAiError(
            """Invalid decision tree format, unable to find the version"""
            """ informations."""
        )

    # Checking version and tree validity according to version
    if re.compile(r"\d+.\d+.\d+").match(tree_version) is None:
        raise CraftAiError(
            """Invalid decision tree format, "{}" is not a valid version.""".format(
                tree_version
            )
        )
    elif tree_version >= VersionInfo(1, 0, 0) and tree_version < VersionInfo(3, 0, 0):
        if tree_object.get("configuration") is None:
            raise CraftAiError(
                """Invalid decision tree format, no configuration found"""
            )
        if tree_object.get("trees") is None:
            raise CraftAiError("""Invalid decision tree format, no tree found.""")
    else:
        raise CraftAiError(
            """Invalid decision tree format, {} is not a supported"""
            """ version.""".format(tree_version)
        )

    if folded_nodes is None:
        folded_nodes = []
    elif not isinstance(folded_nodes, list):

# Path: craft_ai/pandas/constants.py
# MISSING_VALUE = MissingValue()
# 
# OPTIONAL_VALUE = OptionalValue()
# 
# Path: craft_ai/constants.py
# REACT_CRAFT_AI_DECISION_TREE_VERSION = "0.0.23"
# 
# Path: craft_ai/errors.py
# class CraftAiError(Exception):
#     """Base class for exceptions in the craft ai client."""
# 
#     def __init__(self, message=None, metadata=None):
#         self.message = message
#         self.metadata = metadata
#         super(CraftAiError, self).__init__(message, metadata)
# 
#     def __str__(self):
#         return repr(self.message)


# Path: craft_ai/pandas/utils.py
import json
import re
import string
import importlib
import pandas as pd
from random import choice
from semver import VersionInfo
from .constants import (
    MISSING_VALUE,
    OPTIONAL_VALUE,
)
from ..constants import REACT_CRAFT_AI_DECISION_TREE_VERSION
from ..errors import CraftAiError

    tree_version = tree_object.get("_version")
    if not tree_version:
        raise CraftAiError(
            """Invalid decision tree format, unable to find the version"""
            """ informations."""
        )

    # Checking version and tree validity according to version
    if re.compile(r"\d+.\d+.\d+").match(tree_version) is None:
        raise CraftAiError(
            """Invalid decision tree format, "{}" is not a valid version.""".format(
                tree_version
            )
        )
    elif tree_version >= VersionInfo(1, 0, 0) and tree_version < VersionInfo(3, 0, 0):
        if tree_object.get("configuration") is None:
            raise CraftAiError(
                """Invalid decision tree format, no configuration found"""
            )
        if tree_object.get("trees") is None:
            raise CraftAiError("""Invalid decision tree format, no tree found.""")
    else:
        raise CraftAiError(
            """Invalid decision tree format, {} is not a supported"""
            """ version.""".format(tree_version)
        )

    if folded_nodes is None:
        folded_nodes = []
    elif not isinstance(folded_nodes, list):

        raise CraftAiError(