code: def to_bytes(s):
      '''Return s as a bytes type, using utf-8 encoding if necessary.
      @param s string or bytes
      @return bytes
      '''
      if isinstance(s, six.binary_type):
          return s
      if isinstance(s, six.string_types):
          return s.encode('utf-8')
      raise TypeError('want string or bytes, got {}', type(s)f to_bytes(s):
      '''Return s as a bytes type, using utf-8 encoding if necessary.
      @param s string or bytes
      @return bytes
      '''
      if isinstance(s, six.binary_type):
          return s
      if isinstance(s, six.string_types):
          return s.encode('utf-8')
      raise TypeError('want string or bytes, got {}', type(s))
docs: Return s as a bytes type, using utf-8 encoding if necessary.
      @param s string or bytes
      @return bytes