import datetime


def get_session_start_time_local(session_info_filename):
    """
    Finds the local time at which the session was started, according to the _SESSION_INFO.txt file.
    :param session_info_filename: path to session info filename
    :return: datetime.datetime object representing local time at which session was initialized
    """
    with open(session_info_filename, 'r') as f:
        for line in f:
            if line.startswith("Session initialization time (local): "):
                ts = line.strip("Session initialization time (local): ")
                ts = datetime.datetime.strptime(ts.strip(), "%Y-%m-%d %H:%M:%S.%f")
                break
        else:
            raise ValueError("Couldn't find line with timestamp.")
    return ts