try:importuioasioexcept:importiotry:io.IOBaseexceptAttributeError:print('SKIP')raiseSystemExitclassMyIO(io.IOBase):defwrite(self,buf):# CPython and uPy pass in different types for buf (str vs bytearray)print('write',len(buf))returnlen(buf)print('test',file=MyIO())