spy: ensure bytes in write()
diff --git a/serial/urlhandler/protocol_spy.py b/serial/urlhandler/protocol_spy.py
index 92aaa2e..67c700b 100644
--- a/serial/urlhandler/protocol_spy.py
+++ b/serial/urlhandler/protocol_spy.py
@@ -26,6 +26,7 @@
 import time
 
 import serial
+from serial.serialutil import  to_bytes
 
 try:
     import urlparse
@@ -200,6 +201,7 @@
         return ''.join([parts.netloc, parts.path])
 
     def write(self, tx):
+        tx = to_bytes(tx)
         self.formatter.tx(tx)
         return super(Serial, self).write(tx)