def wrapper(db,feature_type,sample,*args,**kwargs):
     result_json = func(db,feature_type,sample,*args,**kwargs)
     if my_classifier.is_success(result_json):            
         option = sample._id
         event_id = generate_event_id(func.__name__,feature_type,option)
         event = {'_id':event_id}
         result_json['event'] = event
     return result_json
 def wrapper(db, feature_type, *args,**kwargs):
     result_json = func(db,feature_type, *args,**kwargs)
     if my_classifier.is_success(result_json):
         access_history = db['timestamps']
         event = result_json['event']
         time = datetime.now()
         #    print time
         event['time'] = time
         try:
             #print event
             access_history.replace_one({'_id':event['_id']},event,True)
         except:
             return my_classifier.error_json(sys.exc_info()[1])
     return result_json