def lookup(self, iterable, index=<NUM_LIT:0>, gather=False, edit_distance=<NUM_LIT:0>, max_edit_distance=<NUM_LIT:0>, match_threshold=<NUM_LIT:0.0>, matched_length=<NUM_LIT:0>):
if self.is_terminal:<EOL><INDENT>if index == len(iterable) or(gather and index < len(iterable) and iterable[index] == '<STR_LIT:U+0020>'):  <EOL><INDENT>confidence = float(len(self.key) - edit_distance) / float(max(len(self.key), index))<EOL>if confidence > match_threshold:<EOL><INDENT>yield {<EOL>'<STR_LIT:key>': self.key,<EOL>'<STR_LIT>': iterable[:index],<EOL>'<STR_LIT:data>': self.data,<EOL>'<STR_LIT>': confidence * self.weight<EOL>}<EOL><DEDENT><DEDENT><DEDENT>if index < len(iterable) and iterable[index] in self.children:<EOL><INDENT>for result in self.children[iterable[index]].lookup(iterable, index + <NUM_LIT:1>, gather=gather,<EOL>edit_distance=edit_distance, max_edit_distance=max_edit_distance, matched_length=matched_length + <NUM_LIT:1>):<EOL><INDENT>yield result<EOL><DEDENT><DEDENT>potential_confidence = float(index - edit_distance + (max_edit_distance - edit_distance)) /(float(index) + (max_edit_distance - edit_distance)) if index + max_edit_distance - edit_distance > <NUM_LIT:0> else <NUM_LIT:0.0><EOL>if edit_distance < max_edit_distance and potential_confidence > match_threshold:<EOL><INDENT>for child in list(self.children):<EOL><INDENT>if index >= len(iterable) or child != iterable[index]:<EOL><INDENT>for result in self.children[child].lookup(iterable, index + <NUM_LIT:1>, gather=gather,<EOL>edit_distance=edit_distance + <NUM_LIT:1>, max_edit_distance=max_edit_distance, matched_length=matched_length):<EOL><INDENT>yield result<EOL><DEDENT>for result in self.children[child].lookup(iterable, index + <NUM_LIT:2>, gather=gather,<EOL>edit_distance=edit_distance + <NUM_LIT:1>, max_edit_distance=max_edit_distance, matched_length=matched_length):<EOL><INDENT>yield result<EOL><DEDENT>for result in self.children[child].lookup(iterable, index, gather=gather,<EOL>edit_distance=edit_distance + <NUM_LIT:1>, max_edit_distance=max_edit_distance, matched_length=matched_length):<EOL><INDENT>yield result<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
TODO: Implement trie lookup with edit distance

Args:
    iterable(list?): key used to find what is requested this could
        be a generator.
    index(int): index of what is requested
    gather(bool): of weather to gather or not
    edit_distance(int): the distance -- currently not used
    max_edit_distance(int): the max distance -- not currently used

yields:
    object: yields the results of the search