<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def yaml2tree(cls, yamltree):
 """Class method that creates a tree from YAML. | # Example yamltree data: | - !Node &root | name: "root node" | parent: null | data: | testpara: 111 | - !Node &child1 | name: "child node" | parent: *root | - !Node &gc1 | name: "grand-child node" | parent: *child1 :param yamltree: a string of YAML describing the nodes in the tree, or the path to a file containing the data. :type yamltree: str :returns: the root node of the tree. :rtype: Node """

        if not cls.YAML_setup:
            cls.setup_yaml()
            cls.YAML_setup = True 
        if os.path.isfile(yamltree):
            with open(yamltree) as fh:
                yaml_data = fh.read()
        else:
            yaml_data = yamltree
        list_of_nodes = yaml.safe_load(yaml_data)
        yamltree_root = list_of_nodes[0]
        return yamltree_root