<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def fire_event(self, data, tag, timeout=1000):
        '''
        Send a single event into the publisher with payload dict "data" and
        event identifier "tag"

        The default is 1000 ms
        '''
        if not six.text_type(tag):  # no empty tags allowed
            raise ValueError('Empty tag.')

        if not isinstance(data, MutableMapping):  # data must be dict
            raise ValueError(
                'Dict object expected, not \'{0}\'.'.format(data)
            )

        if not self.cpush:
            if timeout is not None:
                timeout_s = float(timeout) / 1000
            else:
                timeout_s = None
            if not self.connect_pull(timeout=timeout_s):
                return False

        data['_stamp'] = datetime.datetime.utcnow().isoformat()

        tagend = TAGEND
        if six.PY2:
            dump_data = self.serial.dumps(data)
        else:
            # Since the pack / unpack logic here is for local events only,
            # it is safe to change the wire protocol. The mechanism
            # that sends events from minion to master is outside this
            # file.
            dump_data = self.serial.dumps(data, use_bin_type=True)

        serialized_data = salt.utils.dicttrim.trim_dict(
            dump_data,
            self.opts['max_event_size'],
            is_msgpacked=True,
            use_bin_type=six.PY3
        )
        log.debug('Sending event: tag = %s; data = %s', tag, data)
        event = b''.join([
            salt.utils.stringutils.to_bytes(tag),
            salt.utils.stringutils.to_bytes(tagend),
            serialized_data])
        msg = salt.utils.stringutils.to_bytes(event, 'utf-8')
        if self._run_io_loop_sync:
            with salt.utils.asynchronous.current_ioloop(self.io_loop):
                try:
                    self.io_loop.run_sync(lambda: self.pusher.send(msg))
                except Exception as ex:
                    log.debug(ex)
                    raise
        else:
            self.io_loop.spawn_callback(self.pusher.send, msg)
        return True