def str2bytes(string):
 if (isinstance(string, type('')) and (PY_MAJOR_VERSION > 2)):
  return bytes(string, 'latin1')
 else:
  return string

def str2bytes ( string ) : if ( isinstance ( string , type ( '' ) ) and ( PY_MAJOR_VERSION > 2 ) ) : return bytes ( string , 'latin1' ) else : return string
for cross compatibility between python 2 and python 3 strings .