code: def stage_counter(self):
          
          if 'stage_counter' in self.data and self.data.stage_counter:
              return self.data.get('stage_counter')
          else:
              return self.stage.data.counter
docs: Get stage counter of current job instance.
  
          Because instantiating job instance could be performed in different ways and those return different results,
          we have to check where from to get counter of the stage.
  
          :return: stage counter.