PIL image 2 wx bitmap

def image2wxbitmap(img):
    "PIL image 2 wx bitmap"
    if is_wxPhoenix:
        wximg = wx.Image(*img.size)
    else:
        wximg = wx.EmptyImage(*img.size)
    wximg.SetData(img.tobytes())
    return wximg.ConvertToBitmap()