Support python3.

Import queue on python3 and Queue on python2. Use bytestrings for all
string constants. Slice byte arrays when comparing to bytestrings. Don't
use basestring. Gear now expects its packet data to be byte strings.
Non data fields may be passed as unicode strings, bytes or bytearrays.
Unicode strings will be converted to bytes using the utf8 encoding.

Change-Id: Iccdd01f9ce6f649f8bbaa93370d330c78c89f087