<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _filter_sources(self, sources):
 """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 """

        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']))