def METHOD_NAME(self, languages):
    from tesserocr import PyTessBaseAPI, PSM, OEM
    if not hasattr(self.tl, "api") or self.tl.api is None:
        log.info("Configuring OCR engine (%s)", languages)
        self.tl.api = PyTessBaseAPI(
            lang=languages, oem=OEM.LSTM_ONLY, psm=PSM.AUTO_OSD
        )
    if languages != self.tl.api.GetInitLanguagesAsString():
        log.info("Re-initialising OCR engine (%s)", languages)
        self.tl.api.Init(lang=languages, oem=OEM.LSTM_ONLY)
    return self.tl.api