title: Python3x TypeError
body: <p>The following code works on Python 2.7.x but not for Python 3.x (bytes-like-object is expected not str)
  Am I missing something? Is there a better way of doing this for Python3?</p>
  
  <pre><code>  def vsend(self, framestring):
      totalsent = 0
      metasent = 0
      length =len(framestring)
      lengthstr=str(length).zfill(8)
  
      while metasent &lt; 8 :
  
          sent = self.sock.send(lengthstr[metasent:])
          if sent == 0:
              raise RuntimeError("Socket connection broken")
          metasent += sent
  
  
      while totalsent &lt; length :
          sent = self.sock.send(framestring[totalsent:])
          if sent == 0:
              raise RuntimeError("Socket connection broken")
          totalsent += sent
  </code></pre>
  
  <p>ERROR:
   sent = self.sock.send(lengthstr[metasent:])
   TypeError: a bytes-like object is required, not 'str'
   [ WARN:0] terminating async callback</p>