This “hack” works for imports from Google Calendar and feeds that correspond to the iCalendar standard (iCal feeds and ICS files).
To make this work, create a draft event with no data. Create only the block structure.
Once saved, grab the post ID. Enter that post ID in the first line of the function, where:
$template_post_id = postID;