code: def get_decision_tree(self, agent_id, timestamp=None, version=DEFAULT_DECISION_TREE_VERSION):
      
      # Raises an error when agent_id is invalid
      self._check_agent_id(agent_id)
      if self._config["decisionTreeRetrievalTimeout"] is False:
        # Don't retry
        return self._get_decision_tree(agent_id, timestamp, version)
  
      start = current_time_ms()
      while True:
        now = current_time_ms()
        if now - start > self._config["decisionTreeRetrievalTimeout"]:
          # Client side timeout
          raise CraftAiLongRequestTimeOutError()
        try:
          return self._get_decision_tree(agent_id, timestamp, version)
        except CraftAiLongRequestTimeOutError:
          # Do nothing and continue.
          continue
docs: Get decision tree.
  
      :param str agent_id: the id of the agent to get the tree. It
      must be an str containing only characters in "a-zA-Z0-9_-" and
      must be between 1 and 36 characters.
      :param int timestamp: Optional. The decision tree is comptuted
      at this timestamp.
      :default timestamp: None, means that we get the tree computed
      with all its context history.
      :param version: version of the tree to get.
      :type version: str or int.
      :default version: default version of the tree.
  
      :return: decision tree.
      :rtype: dict.
  
      :raises CraftAiLongRequestTimeOutError: if the API doesn't get
      the tree in the time given by the configuration.