code: def _filter_sources(self, sources):
          filtered, hosts = [], []
          for source in sources:
              if 'error' in source:
                  continue
              filtered.append(source)
              hosts.append(source['host_name'])
          return sorted(filtered, key=lambda s:
                        self._hosts_by_success(hosts).index(s['host_name']))