code: def build(self, client,
                nobuild=False,
                usecache=True,
                pull=False):
          if not nobuild:
              self.update_source_images(client,
                                        usecache=usecache,
                                        pull=pull)
          width = utils.get_console_width()
          cprint('\n' + '='*width,
                 color='white', attrs=['bold'])
          line = 'STARTING BUILD for "%s" (image definition "%s" from %s)\n' % (
              self.targetname, self.imagename, self.steps[-1].sourcefile)
          cprint(_centered(line, width), color='blue', attrs=['bold'])
          for istep, step in enumerate(self.steps):
              print(colored('* Step','blue'),
                    colored('%d/%d' % (istep+1, len(self.steps)), 'blue', attrs=['bold']),
                    colored('for image', color='blue'),
                    colored(self.imagename, color='blue', attrs=['bold']))
              if not nobuild:
                  if step.bust_cache:
                      stackkey = self._get_stack_key(istep)
                      if stackkey in _rebuilt:
                          step.bust_cache = False
                  step.build(client, usecache=usecache)
                  print(colored("* Created intermediate image", 'green'),
                        colored(step.buildname, 'green', attrs=['bold']),
                        end='\n\n')
                  if step.bust_cache:
                      _rebuilt.add(stackkey)
          finalimage = step.buildname
          if not nobuild:
              self.finalizenames(client, finalimage)
              line = 'FINISHED BUILDING "%s" (image definition "%s" from %s)'%(
                  self.targetname, self.imagename, self.steps[-1].sourcefile)
              cprint(_centered(line, width),
                     color='green', attrs=['bold'])
              cprint('=' * width, color='white', attrs=['bold'], end='\n\n')