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']))
docs: Remove sources with errors and return ordered by host success.
  
          :param sources: List of potential sources to connect to.
          :type sources: list
          :returns: Sorted list of potential sources without errors.
          :rtype: list