A highly documented class implementing everything required to decode and encode byte arrays as data frames following WebSocket specification. Works for python 2.x and 3.x.
For more information see: http://www.altdevblogaday.com/2012/01/23/writing-your-own-websocket-server/