Open file while detecting encoding. Use cached when possible.
        :param file:
        :param how:
        :return:

def open_this(self, file, how):  # type: (str,str) -> Any
        """
        Open file while detecting encoding. Use cached when possible.
        :param file:
        :param how:
        :return:
        """
        # BUG: risky code here, allowing relative
        if not file.startswith("/"):
            # raise TypeError("this isn't absolute! We're siths, ya' know.")
            pass
        if file in self.found_encoding:

            encoding = self.found_encoding[file]
        else:
            file_bytes = io.open(file, "rb").read()
            if not file_bytes:
                encoding = "utf-8"
            else:
                encoding_info = chardet.detect(file_bytes)
                encoding = encoding_info["encoding"]
            logger.debug(unicode(encoding))
            try:
                io.open(file, how, encoding=encoding).read()
            except UnicodeDecodeError:
                print(file)
                print(file_bytes)

            self.found_encoding[file] = encoding

        return io.open(file, how, encoding=encoding)