def __getitem__(self, font_settings):
        """Return surface rendered with given settings.

        Parameters
        ==========
        font_settings (dict)
            contains settings defining how the font must
            be rendered;
        """
        ### convert the render settings (a dict) to a custom
        ### tuple representing them, to use as dictionary key
        tuple_key = settings_to_hashable_repr(font_settings)

        ### try returning the value for the tuple we
        ### just obtained, which, if existent, should
        ### be a surface rendered with the corresponding
        ### settings
        try:
            return super().__getitem__(tuple_key)

        ### if such value doesn't exist (a key error is
        ### raised), we create the corresponding surface,
        ### and return it while at the same time creating
        ### a new item using the tuple key

        except KeyError:

            return self.setdefault(
                tuple_key, render_font_preview(self.font_path, **font_settings)
            )
Return surface rendered with given settings.

        Parameters
        ==========
        font_settings (dict)
            contains settings defining how the font must
            be rendered;
        
nodezator/fontsman/preview/cache.py