def import_stack(self, file, isImport, isForce, rbundles, isUseMajor):
        try:
            if isImport:
                printer.out("Importing template from ["+file+"] archive ...")
            else:
                if constants.TMP_WORKING_DIR in str(file):
                    printer.out("Creating template from temporary ["+file+"] archive ...")
                else:
                    printer.out("Creating template from ["+file+"] archive ...")
            file = open(file, "r")

            # The following code could not be used for the moment
            # appImport = applianceImport()
            # appImport.imported = isImport
            # appImport.forceRw = isForce
            # appImport.reuseBundles = rbundles
            # appImport.useMajor = isUseMajor
            # appImport = self.api.Users(self.login).Imports.Import(appImport)

            appImport = self.api.Users(self.login).Imports.Import(None, None, Imported=isImport, Force=isForce, Reusebundles=rbundles, Usemajor=isUseMajor)
            if appImport is None:
                if isImport:
                    printer.out("error importing appliance", printer.ERROR)
                else:
                    printer.out("error creating appliance", printer.ERROR)
                return 2
            else:
                status = self.api.Users(self.login).Imports(appImport.dbId).Uploads.Upload(file)
                progress = ProgressBar(widgets=[Percentage(), Bar()], maxval=100).start()
                while not (status.complete or status.error):
                    progress.update(status.percentage)
                    status = self.api.Users(self.login).Imports(appImport.dbId).Status.Get()
                    time.sleep(2)
                progress.finish()
                if status.error:
                    if isImport:
                        printer.out("Template import: "+status.message+"\n"+status.errorMessage, printer.ERROR)
                        if status.detailedError:
                            printer.out(status.detailedErrorMsg)
                    else:
                        printer.out("Template create: "+status.message+"\n"+status.errorMessage, printer.ERROR)
                else:
                    if isImport:
                        printer.out("Template import: DONE", printer.OK)
                    else:
                        printer.out("Template create: DONE", printer.OK)

                    #get appliance import
                    appImport = self.api.Users(self.login).Imports(appImport.dbId).Get()
                    printer.out("Template URI: "+appImport.referenceUri)
                    printer.out("Template Id : "+generics_utils.extract_id(appImport.referenceUri))

                return 0
        except __HOLE__ as e:
            printer.out("File error: "+str(e), printer.ERROR)
            return 2
        except Exception as e:
            return handle_uforge_exception(e)
dataset/ETHPy150Open usharesoft/hammr/src/hammr/commands/template/template.py/Template.import_stack