replacing a texture in BGE

Hi,

I have an image contained in the BytesIO object. How can I use it to replace/update texture of a certain object on the scene in the Blender Game Engine.