The line actual_sec = func_ex_status.get('statusCodeData', None) suggests that 'statusCodeData' may be None under normal circumstances. So let's guard sec.update(actual_sec) so that we won't run into an exception in case 'statusCodeData' is not in func_ex_status.