code: def recover_from_duplicatekeyerror(self, e):
          
          if isinstance(e, DuplicateKeyError):
              try:
                  return self.get_by_params(e.process_name, e.timeperiod, e.start_id, e.end_id)
              except LookupError as e:
                  self.logger.error('Unable to recover from DuplicateKeyError error due to {0}'.format(e), exc_info=True)
          else:
              msg = 'Unable to recover from DuplicateKeyError due to unspecified UOW primary key'
              self.logger.error(msg)
docs: method tries to recover from DuplicateKeyError