#NEWLINE# def _convert_codecs( template , byte_order ) : #NEWLINE# #INDENT# " Convert codec template mapping to byte order\n\n    Set codecs not on this system to None\n\n    Parameters\n    ----------\n    template : mapping\n       key, value are respectively codec name, and root name for codec\n       (without byte order suffix)\n    byte_order : {'<', '>'}\n       code for little or big endian\n\n    Returns\n    -------\n    codecs : dict\n       key, value are name, codec (as in .encode(codec))\n    " #NEWLINE# codecs = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# postfix = ( ( ( byte_order == '<' ) and '_le' ) or '_be' ) #NEWLINE# for ( k , v ) in template . items ( ) : #NEWLINE# #INDENT# codec = v [ 'codec' ] #NEWLINE# try : #NEWLINE# #INDENT# ' ' . encode ( codec ) #NEWLINE# #UNINDENT# except LookupError : #NEWLINE# #INDENT# codecs [ k ] = None #NEWLINE# continue #NEWLINE# #UNINDENT# if ( template [ 'width' ] > 1 ) : #NEWLINE# #INDENT# codec += postfix #NEWLINE# #UNINDENT# codecs [ k ] = codec #NEWLINE# #UNINDENT# return codecs . copy ( )