'Read hosts from the given filename.
Args:
filename: The file to read.
target: The set to store the hosts in.
Return:
True if a read was attempted, False otherwise'

def _read_hosts_file(self, filename, target):

    if (not os.path.exists(filename)):
        return False
    try:
        with open(filename, 'r', encoding='utf-8') as f:
            for line in f:
                target.add(line.strip())
    except (OSError, UnicodeDecodeError):
        log.misc.exception('Failed    to    read    host    blocklist!')
    return True
