docs: def top_matches(self, top):
          '''
          Search through the top high data for matches and return the states
          that this minion needs to execute.
  
          Returns:
          {'saltenv': ['state1', 'state2', ...]}
          '''
          matches = DefaultOrderedDict(OrderedDict)
          # pylint: disable=cell-var-from-loop
          for saltenv, body in six.iteritems(top):
              if self.opts['saltenv']:
                  if saltenv != self.opts['saltenv']:
                      continue
              for match, data in six.iteritems(body):
                  def _filter_matches(_match, _data, _opts):
                      if isinstance(_data, six.string_types):
                          _data = [_data]
                      if self.matchers['confirm_top.confirm_top'](
                              _match,
                              _data,
                              _opts
                              ):
                          if saltenv not in matches:
                              matches[saltenv] = []
                          for item in _data:
                              if 'subfilter' in item:
                                  _tmpdata = item.pop('subfilter')
                                  for match, data in six.iteritems(_tmpdata):
                                      _filter_matches(match, data, _opts)
                              if isinstance(item, six.string_types):
                                  matches[saltenv].append(item)
                              elif isinstance(item, dict):
                                  env_key, inc_sls = item.popitem()
                                  if env_key not in self.avail:
                                      continue
                                  if env_key not in matches:
                                      matches[env_key] = []
                                  matches[env_key].append(inc_sls)
                  _filter_matches(match, data, self.opts['nodegroups'])
          ext_matches = self._master_tops()
          for saltenv in ext_matches:
              top_file_matches = matches.get(saltenv, [])
              if self.opts.get('master_tops_first'):
                  first = ext_matches[saltenv]
                  second = top_file_matches
              else:
                  first = top_file_matches
                  second = ext_matches[saltenv]
              matches[saltenv] = first + [x for x in second if x not in first]
  
          # pylint: enable=cell-var-from-loop
          return matches