def encode_name(name):
 if isinstance(name, unicode):
  name = name.encode(u'utf-8')
 return hexlify(name)

def encode_name ( name ) : if isinstance ( name , unicode ) : name = name . encode ( u'utf-8' ) return hexlify ( name )
encode a name as url safe characters .