Generate folders to best match metadata.

        The results will be a single, perfectly matched folder, or the two nearest
        neighbours of an imperfect match.

        :param dict data: metadata matching criteria.

        This method is a generator. It yields
        :py:class:`turberfield.dialogue.model.SceneScript.Folder` objects.

def options(self, data):
        """Generate folders to best match metadata.

        The results will be a single, perfectly matched folder, or the two nearest
        neighbours of an imperfect match.

        :param dict data: metadata matching criteria.

        This method is a generator. It yields
        :py:class:`turberfield.dialogue.model.SceneScript.Folder` objects.

        """
        if self.mapping_key(data) in self.keys:
            yield next(i for i in self.folders if i.metadata == data)
        else:
            index = bisect.bisect_left(self.keys, self.mapping_key(data))
            posns = sorted(set([max(0, index - 1), index]))
            yield from (self.folders[i] for i in posns)