docs: def event(self, chunk_ret, length, fire_event=False):
          '''
          Fire an event on the master bus
  
          If `fire_event` is set to True an event will be sent with the
          chunk name in the tag and the chunk result in the event data.
  
          If `fire_event` is set to a string such as `mystate/is/finished`,
          an event will be sent with the string added to the tag and the chunk
          result in the event data.
  
          If the `state_events` is set to True in the config, then after the
          chunk is evaluated an event will be set up to the master with the
          results.
          '''
          if not self.opts.get('local') and (self.opts.get('state_events', True) or fire_event):
              if not self.opts.get('master_uri'):
                  ev_func = lambda ret, tag, preload=None: salt.utils.event.get_master_event(
                      self.opts, self.opts['sock_dir'], listen=False).fire_event(ret, tag)
              else:
                  ev_func = self.functions['event.fire_master']
  
              ret = {'ret': chunk_ret}
              if fire_event is True:
                  tag = salt.utils.event.tagify(
                          [self.jid, self.opts['id'], six.text_type(chunk_ret['name'])], 'state_result'
                          )
              elif isinstance(fire_event, six.string_types):
                  tag = salt.utils.event.tagify(
                          [self.jid, self.opts['id'], six.text_type(fire_event)], 'state_result'
                          )
              else:
                  tag = salt.utils.event.tagify(
                          [self.jid, 'prog', self.opts['id'], six.text_type(chunk_ret['__run_num__'])], 'job'
                          )
                  ret['len'] = length
              preload = {'jid': self.jid}
              ev_func(ret, tag, preload=preload)