from datetime import datetime


def _get_stop_as_datetime(event_json)->datetime:
    """Reads the stop timestamp of the event and returns it as a datetime
    object.

    Args:
        event_json (json): The event encapsulated as json.
    Returns
        datetime: Timestamp of the stop of the event.
    """
    name = event_json['info']['name']
    payload_stop = 'meta.raw_payload.' + name + '-stop'

    stop_timestamp_string = event_json['info'][payload_stop]['timestamp']

    stop_date_string, stop_time_string = stop_timestamp_string.split('T')
    stop_time_string, _ = stop_time_string.split('.')

    date_and_time_string = stop_date_string + ' ' + stop_time_string

    return datetime.strptime(date_and_time_string, '%Y-%m-%d %H:%M:%S')