docs: def perform_initialization(self):
          '''Initialize the harvesting for a given job'''
          log.debug('Initializing backend')
          factory = HarvestJob if self.dryrun else HarvestJob.objects.create
          self.job = factory(status='initializing',
                             started=datetime.now(),
                             source=self.source)
  
          before_harvest_job.send(self)
  
          try:
              self.initialize()
              self.job.status = 'initialized'
              if not self.dryrun:
                  self.job.save()
          except HarvestValidationError as e:
              log.info('Initialization failed for "%s" (%s)',
                       safe_unicode(self.source.name), self.source.backend)
              error = HarvestError(message=safe_unicode(e))
              self.job.errors.append(error)
              self.job.status = 'failed'
              self.end()
              return
          except Exception as e:
              self.job.status = 'failed'
              error = HarvestError(message=safe_unicode(e))
              self.job.errors.append(error)
              self.end()
              msg = 'Initialization failed for "{0.name}" ({0.backend})'
              log.exception(msg.format(self.source))
              return
  
          if self.max_items:
              self.job.items = self.job.items[:self.max_items]
  
          if self.job.items:
              log.debug('Queued %s items', len(self.job.items))
  
          return len(self.job.items)