def is_utf8(p):
 utf8 = True
 try:
  p.decode('ascii')
 except:
  try:
   p.decode('utf-8')
  except:
   utf8 = False
 return utf8

def is_utf8 ( p ) : utf8 = True try : p . decode ( 'ascii' ) except : try : p . decode ( 'utf-8' ) except : utf8 = False return utf8
return true when p is utf-8 or plain ascii .