Reference the given taskfileinfo into the scene and return the created reference node

        The created reference node will be used on :meth:`RefobjInterface.set_reference` to
        set the reference on a reftrack node.
        Do not call :meth:`RefobjInterface.set_reference` yourself.

        This will also create a group node and group all dagnodes under a appropriate node.

        :param refobj: the reftrack node that will be linked to the reference
        :type refobj: str
        :param taskfileinfo: The taskfileinfo that holds the information for what to reference
        :type taskfileinfo: :class:`jukeboxcore.filesys.TaskFileInfo`
        :returns: the reference node that was created and should set on the appropriate reftrack node
        :rtype: str
        :raises: None

def reference(self, refobj, taskfileinfo):
        """Reference the given taskfileinfo into the scene and return the created reference node

        The created reference node will be used on :meth:`RefobjInterface.set_reference` to
        set the reference on a reftrack node.
        Do not call :meth:`RefobjInterface.set_reference` yourself.

        This will also create a group node and group all dagnodes under a appropriate node.

        :param refobj: the reftrack node that will be linked to the reference
        :type refobj: str
        :param taskfileinfo: The taskfileinfo that holds the information for what to reference
        :type taskfileinfo: :class:`jukeboxcore.filesys.TaskFileInfo`
        :returns: the reference node that was created and should set on the appropriate reftrack node
        :rtype: str
        :raises: None
        """
        # work in root namespace
        with common.preserve_namespace(":"):
            jbfile = JB_File(taskfileinfo)
            filepath = jbfile.get_fullpath()
            ns_suggestion = reftrack.get_namespace(taskfileinfo)
            newnodes = cmds.file(filepath, reference=True, namespace=ns_suggestion, returnNewNodes=True)
            # You could also use the filename returned by the file command to query the reference node.
            # Atm there is a but, that if you import the file before, the command fails.
            # So we get all new reference nodes and query the one that is not referenced
            for refnode in cmds.ls(newnodes, type='reference'):
                if not cmds.referenceQuery(refnode, isNodeReferenced=True):
                    node = refnode
                    break
            ns = cmds.referenceQuery(node, namespace=True)  # query the actual new namespace
            content = cmds.namespaceInfo(ns, listOnlyDependencyNodes=True, dagPath=True)  # get the content
            # connect reftrack with scenenode
            scenenode = self.get_scenenode(content)
            self.get_refobjinter().connect_reftrack_scenenode(refobj, scenenode)
            reccontent = cmds.namespaceInfo(ns, listOnlyDependencyNodes=True, dagPath=True, recurse=True)  # get the content + content of children
            dagcontent = cmds.ls(reccontent, ap=True, assemblies=True)  # get only the top level dagnodes so we can group them
            if not dagcontent:
                return node  # no need for a top group if there are not dagnodes to group
            # group the dagnodes
            grpname = reftrack.get_groupname(taskfileinfo)
            reftrack.group_content(dagcontent, ns, grpname, "jb_asset")
            return node