"""Python 2/3 compatibility"""importjsonimportsys# Handle reading and writing JSON in UTF-8, on Python 3 and 2.ifsys.version_info[0]>=3:# Python 3defwrite_json(obj,path,**kwargs):withopen(path,'w',encoding='utf-8')asf:json.dump(obj,f,**kwargs)defread_json(path):withopen(path,'r',encoding='utf-8')asf:returnjson.load(f)else:# Python 2defwrite_json(obj,path,**kwargs):withopen(path,'wb')asf:json.dump(obj,f,encoding='utf-8',**kwargs)defread_json(path):withopen(path,'rb')asf:returnjson.load(f)# FileNotFoundErrortry:FileNotFoundError=FileNotFoundErrorexceptNameError:FileNotFoundError=IOError