#NEWLINE# def utf8encodekeys( metadata ) : #NEWLINE# #INDENT# uni_keys = [ k for k in metadata if isinstance ( k , six . text_type ) ] #NEWLINE# for k in uni_keys : #NEWLINE# #INDENT# sv = metadata [ k ] #NEWLINE# del metadata [ k ] #NEWLINE# metadata [ k . encode ( 'utf-8' ) ] = sv