def loadpkl(infile):
 fmlogger.debug(u'Loading pkl: %s', infile)
 if infile.endswith(u'pklz'):
  pkl_file = gzip.open(infile, u'rb')
 else:
  pkl_file = open(infile, u'rb')
 try:
  unpkl = pickle.load(pkl_file)
 except UnicodeDecodeError:
  unpkl = pickle.load(pkl_file, fix_imports=True, encoding=u'utf-8')
 return unpkl

def loadpkl ( infile ) : fmlogger . debug ( u'Loading pkl: %s' , infile ) if infile . endswith ( u'pklz' ) : pkl_file = gzip . open ( infile , u'rb' ) else : pkl_file = open ( infile , u'rb' ) try : unpkl = pickle . load ( pkl_file ) except UnicodeDecodeError : unpkl = pickle . load ( pkl_file , fix_imports = True , encoding = u'utf-8' ) return unpkl
load a zipped or plain cpickled file .