def send_rate_limited_pm_notification_to_bot_owner(sender: UserProfile, realm: Realm, content: str) -> None:
    "\n    Sends a PM error notification to a bot's owner if one hasn't already\n    been sent in the last 5 minutes.\n    "
    if (sender.realm.is_zephyr_mirror_realm or sender.realm.deactivated):
        return
    if ((not sender.is_bot) or (sender.bot_owner is None)):
        return
    if (sender.realm != realm):
        return
    last_reminder = sender.last_reminder
    waitperiod = datetime.timedelta(minutes=UserProfile.BOT_OWNER_STREAM_ALERT_WAITPERIOD)
    if (last_reminder and ((timezone_now() - last_reminder) <= waitperiod)):
        return
    internal_send_private_message(realm, get_system_bot(settings.NOTIFICATION_BOT), sender.bot_owner, content)
    sender.last_reminder = timezone_now()
    sender.save(update_fields=['last_reminder'])
Sends a PM error notification to a bot's owner if one hasn't already
been sent in the last 5 minutes.
def send_rate_limited_pm_notification_to_bot_owner(sender: UserProfile, realm: Realm, content: str) -> None:
    "\n    Sends a PM error notification to a bot's owner if one hasn't already\n    been sent in the last 5 minutes.\n    "
    if (sender.realm.is_zephyr_mirror_realm or sender.realm.deactivated):
        return
    if ((not sender.is_bot) or (sender.bot_owner is None)):
        return
    if (sender.realm != realm):
        return
    last_reminder = sender.last_reminder
    waitperiod = datetime.timedelta(minutes=UserProfile.BOT_OWNER_STREAM_ALERT_WAITPERIOD)
    if (last_reminder and ((timezone_now() - last_reminder) <= waitperiod)):
        return
    internal_send_private_message(realm, get_system_bot(settings.NOTIFICATION_BOT), sender.bot_owner, content)
    sender.last_reminder = timezone_now()
    sender.save(update_fields=['last_reminder'])