code: def process(self, salt_data, token, opts):
          '''
          Process events and publish data
          '''
          parts = salt_data['tag'].split('/')
          if len(parts) < 2:
              return
  
          # TBD: Simplify these conditional expressions
          if parts[1] == 'job':
              if parts[3] == 'new':
                  self.process_new_job_event(salt_data)
                  if salt_data['data']['fun'] == 'grains.items':
                      self.minions = {}
              elif parts[3] == 'ret':
                  self.process_ret_job_event(salt_data)
                  if salt_data['data']['fun'] == 'grains.items':
                      self.process_minion_update(salt_data)
          if parts[1] == 'key':
              self.process_key_event(salt_data)
          if parts[1] == 'presence':
              self.process_presence_events(salt_data, token, optsf process(self, salt_data, token, opts):
          '''
          Process events and publish data
          '''
          parts = salt_data['tag'].split('/')
          if len(parts) < 2:
              return
  
          # TBD: Simplify these conditional expressions
          if parts[1] == 'job':
              if parts[3] == 'new':
                  self.process_new_job_event(salt_data)
                  if salt_data['data']['fun'] == 'grains.items':
                      self.minions = {}
              elif parts[3] == 'ret':
                  self.process_ret_job_event(salt_data)
                  if salt_data['data']['fun'] == 'grains.items':
                      self.process_minion_update(salt_data)
          if parts[1] == 'key':
              self.process_key_event(salt_data)
          if parts[1] == 'presence':
              self.process_presence_events(salt_data, token, opts)
docs: Process events and publish data