def to_bytestring(data):
 if (not isinstance(data, six.binary_type)):
  data = six.text_type(data).encode('utf-8')
 return data

def to_bytestring ( data ) : if ( not isinstance ( data , six . binary_type ) ) : data = six . text_type ( data ) . encode ( 'utf-8' ) return data
converts a single string to a bytestring .