def detect_language(self, text: str, hint: str = None):
        """
        Detects the language of a text
        :param text:
            Text to analyze 
        :param hint: 
            A list which are hints for the API 
            in which language the text is written in  
            example:
            "de, en"
        :return: 
            detected language code. example: "en"
        """
        encodedtext = urllib.parse.quote(text)

        args = "&text=" + encodedtext
        if hint is not None:
            args += "&hint=" + hint

        r = self.yandex_translate_request("detect", args)
        self.handle_errors(r)
        return r.json()["lang"]