from datetime import datetime


def get_session_start_time(recording_metadata: dict) -> datetime:
    """Fetches the session start time from the recording_metadata dic
    Parameters
    ----------
    recording_metadata : dict
        the metadata dic as obtained from the Spikelgx recording.

    Returns
    -------
    datetime
        the session start time in datetime format.
    """

    session_start_time = recording_metadata.get("fileCreateTime", None)
    if session_start_time:
        session_start_time = datetime.fromisoformat(session_start_time)

    return session_start_time