# coding:utf-8fromcopyimportdeepcopydefexceptionHandler(*default):""" decorator for exception handling Parameters ---------- *default: the default value returned when an exception occurs """defouter(func):definner(*args,**kwargs):try:returnfunc(*args,**kwargs)exceptBaseExceptionase:value=deepcopy(default)iflen(value)==0:returnNoneeliflen(value)==1:returnvalue[0]returnvaluereturninnerreturnouter