Find all of the listen routines and call the associated mod_watch runs

def call_listen(self, chunks, running):
        '''
        Find all of the listen routines and call the associated mod_watch runs
        '''
        listeners = []
        crefs = {}
        for chunk in chunks:
            crefs[(chunk['state'], chunk['__id__'], chunk['name'])] = chunk
            if 'listen' in chunk:
                listeners.append({(chunk['state'], chunk['__id__'], chunk['name']): chunk['listen']})
            if 'listen_in' in chunk:
                for l_in in chunk['listen_in']:
                    for key, val in six.iteritems(l_in):
                        listeners.append({(key, val, 'lookup'): [{chunk['state']: chunk['__id__']}]})
        mod_watchers = []
        errors = {}
        for l_dict in listeners:
            for key, val in six.iteritems(l_dict):
                for listen_to in val:
                    if not isinstance(listen_to, dict):
                        found = False
                        for chunk in chunks:
                            if chunk['__id__'] == listen_to or \
                               chunk['name'] == listen_to:
                                listen_to = {chunk['state']: chunk['__id__']}
                                found = True
                        if not found:
                            continue
                    for lkey, lval in six.iteritems(listen_to):
                        if not any(lkey == cref[0] and lval in cref for cref in crefs):
                            rerror = {_l_tag(lkey, lval):
                                      {
                                          'comment': 'Referenced state {0}: {1} does not exist'.format(lkey, lval),
                                          'name': 'listen_{0}:{1}'.format(lkey, lval),
                                          'result': False,
                                          'changes': {}
                                      }}
                            errors.update(rerror)
                            continue
                        to_tags = [
                            _gen_tag(data) for cref, data in six.iteritems(crefs) if lkey == cref[0] and lval in cref
                        ]
                        for to_tag in to_tags:
                            if to_tag not in running:
                                continue
                            if running[to_tag]['changes']:
                                if not any(key[0] == cref[0] and key[1] in cref for cref in crefs):
                                    rerror = {_l_tag(key[0], key[1]):
                                                 {'comment': 'Referenced state {0}: {1} does not exist'.format(key[0], key[1]),
                                                  'name': 'listen_{0}:{1}'.format(key[0], key[1]),
                                                  'result': False,
                                                  'changes': {}}}
                                    errors.update(rerror)
                                    continue

                                new_chunks = [data for cref, data in six.iteritems(crefs) if key[0] == cref[0] and key[1] in cref]
                                for chunk in new_chunks:
                                    low = chunk.copy()
                                    low['sfun'] = chunk['fun']
                                    low['fun'] = 'mod_watch'
                                    low['__id__'] = 'listener_{0}'.format(low['__id__'])
                                    for req in STATE_REQUISITE_KEYWORDS:
                                        if req in low:
                                            low.pop(req)
                                    mod_watchers.append(low)
        ret = self.call_chunks(mod_watchers)
        running.update(ret)
        for err in errors:
            errors[err]['__run_num__'] = self.__run_num
            self.__run_num += 1
        running.update(errors)
        return running