code: async def process_events_async(self, events):
          
          if events:
              # Synchronize to serialize calls to the processor. The handler is not installed until
              # after OpenAsync returns, so ProcessEventsAsync cannot conflict with OpenAsync. There
              # could be a conflict between ProcessEventsAsync and CloseAsync, however. All calls to
              # CloseAsync are protected by synchronizing too.
              try:
                  last = events[-1]
                  if last is not None:
                      self.partition_context.set_offset_and_sequence_number(last)
                      await self.processor.process_events_async(self.partition_context, events)
              except Exception as err:  # pylint: disable=broad-except
                  await self.process_error_async(err)
docs: Process pump events.
  
          :param events: List of events to be processed.
          :type events: list[~azure.eventhub.common.EventData]