def _get_ref_event_time(**kwargs) -> Tuple[(datetime, str)]:
    'Extract the reference time from kwargs.'
    ref_alert = kwargs.get('alert', None)
    if (ref_alert is not None):
        ref_event = ref_alert
        ref_label = 'Alert time'
    else:
        ref_event = kwargs.get('ref_event', None)
        ref_label = 'Event time'
    if (ref_event is not None):
        ref_time = getattr(ref_event, 'StartTimeUtc', None)
        if (not ref_time):
            ref_time = getattr(ref_event, 'TimeGenerated', None)
    else:
        ref_time = kwargs.get('ref_time', None)
        ref_label = 'Ref time'
    return (ref_time, kwargs.get('ref_label', ref_label))
Extract the reference time from kwargs.
def _get_ref_event_time(**kwargs) -> Tuple[(datetime, str)]:
    
    ref_alert = kwargs.get('alert', None)
    if (ref_alert is not None):
        ref_event = ref_alert
        ref_label = 'Alert time'
    else:
        ref_event = kwargs.get('ref_event', None)
        ref_label = 'Event time'
    if (ref_event is not None):
        ref_time = getattr(ref_event, 'StartTimeUtc', None)
        if (not ref_time):
            ref_time = getattr(ref_event, 'TimeGenerated', None)
    else:
        ref_time = kwargs.get('ref_time', None)
        ref_label = 'Ref time'
    return (ref_time, kwargs.get('ref_label', ref_label))