def importReferences(self, includeNested=1, removeNamespaces=1, returnNodes=0, node=''):
        """
        SYNOPSIS
         Imports all references for the current scene

        INPUTS
         (bool)	includeNested:		also include nested references
         (bool)	removeNamespaces:	remove no namespaces (0), remove all namespaces (1) & strip namespaces to 1 level (2)
         (bool)	returnNodes:		pass back all nodes imported
         (str)*	node:				Pass a node and only act on the reference, the node belongs to. If the reference passed is nested, includeNested will be forced.

        RETURNS:
         (list) imported nodes (If returnNodes is passed (1))
        """

        #Get all the top level references
        rNodes = []
        cleanNS = []
        initError = 0

        # Prep checks
        if removeNamespaces:
            if removeNamespaces == 2 and not includeNested:
                self.logger.error(
                    'If you want to strip down to 1 namespace level (removeNamespaces=2) , you must pass includeNested as 1')
                initError = 1

        if not initError:
            allRefs = self.getRefs(includeNested=includeNested, node=node)
            for each in allRefs:
                ns = each.namespace
                subRefs = self.getNestedRefs(each)
                if subRefs:
                    for cns in subRefs:
                        cleanNS.append([cns.namespace, ns])
                nodes = each.nodes()
                each.importContents()

                # Remove all namespaces
                if removeNamespaces:
                    if removeNamespaces == 1:
                        namespace(mv=(ns, ':'), f=1)  #@UndefinedVariable
                        Namespace(ns).remove()
                # Store all nodes that was a part of the referenced file
                if returnNodes:
                    rNodes.extend(nodes)

            # Strip to 1 9 level
            if removeNamespaces:
                if removeNamespaces == 2:
                    for c in cleanNS:
                        Namespace.create(c[0])
                        self.logger.info('Moving name space - %s:%s - to - %s' % (c[1], c[0], c[0]))
                        namespace(mv=('%s:%s' % (c[1], c[0]), c[0]), f=1)  #@UndefinedVariable
                    for delC in cleanNS:
                        Namespace('%s:%s' % (delC[1], delC[0])).remove()
                    for unused in cleanNS:
                        if ':%s' % delC[1] in listNamespaces():
                            Namespace(':%s' % delC[1]).remove()

        removed = ''
        if removeNamespaces:
            removed = ', namespaces removed'
        self.logger.info('References imported%s' % removed)

        if returnNodes:
            existingRNodes = []
            for r in rNodes:
                if objExists(r):
                    existingRNodes.append(r)
            if existingRNodes:
                return existingRNodes
dataset/ETHPy150Open CountZer0/PipelineConstructionSet/python/maya/core/mayaCore.py/MayaReferenceCore.importReferences/original