Finds the fuzzy matches (within edit distance 1) of w from words

def query(self, w, ed=1):  # Can only handle ed=1
        """
        Finds the fuzzy matches (within edit distance 1) of w from words 
        """
        assert ed <= self._ed
        if ed == 0:
            return [w] if w in self._L else ['']
        w = str(w)
        n = len(w)
        prefix, suffix = w[:n // 2], w[n // 2:][::-1]
        options_w_prefix = self._L.keys(prefix)
        options_w_suffix = [x[::-1] for x in self._R.iterkeys(suffix)]
        return [
            _w
            for _w in set(itertools.chain(options_w_prefix, options_w_suffix))
            if abs(len(_w) - len(w)) <= 1 and lvdistance(str(_w), str(w), 1) <= 1
        ]