Helper function for fire_ret_load

def _fire_ret_load_specific_fun(self, load, fun_index=0):
        '''
        Helper function for fire_ret_load
        '''
        if isinstance(load['fun'], list):
            # Multi-function job
            fun = load['fun'][fun_index]
            # 'retcode' was already validated to exist and be non-zero
            # for the given function in the caller.
            if isinstance(load['retcode'], list):
                # Multi-function ordered
                ret = load.get('return')
                if isinstance(ret, list) and len(ret) > fun_index:
                    ret = ret[fun_index]
                else:
                    ret = {}
                retcode = load['retcode'][fun_index]
            else:
                ret = load.get('return', {})
                ret = ret.get(fun, {})
                retcode = load['retcode'][fun]
        else:
            # Single-function job
            fun = load['fun']
            ret = load.get('return', {})
            retcode = load['retcode']

        try:
            for tag, data in six.iteritems(ret):
                data['retcode'] = retcode
                tags = tag.split('_|-')
                if data.get('result') is False:
                    self.fire_event(
                        data,
                        '{0}.{1}'.format(tags[0], tags[-1])
                    )  # old dup event
                    data['jid'] = load['jid']
                    data['id'] = load['id']
                    data['success'] = False
                    data['return'] = 'Error: {0}.{1}'.format(
                        tags[0], tags[-1])
                    data['fun'] = fun
                    data['user'] = load['user']
                    self.fire_event(
                        data,
                        tagify([load['jid'],
                                'sub',
                                load['id'],
                                'error',
                                fun],
                               'job'))
        except Exception:
            pass