def check_send_typing_notification(sender: UserProfile, user_ids: List[int], operator: str) -> None:
    realm = sender.realm
    if (len(user_ids) == 0):
        raise JsonableError(_("Missing parameter: 'to' (recipient)"))
    elif (operator not in ('start', 'stop')):
        raise JsonableError(_("Invalid 'op' value (should be start or stop)"))
    ' The next chunk of code will go away when we upgrade old mobile\n    users away from versions of mobile that send emails.  For the\n    small number of very outdated mobile clients, we do double work\n    here in terms of fetching users, but this structure reduces lots\n    of other unnecessary duplicated code and will make it convenient\n    to mostly delete code when we desupport old versions of the\n    app.'
    if (sender.id not in user_ids):
        user_ids.append(sender.id)
    user_profiles = []
    for user_id in user_ids:
        try:
            user_profile = get_user_by_id_in_realm_including_cross_realm(user_id, sender.realm)
        except UserProfile.DoesNotExist:
            raise JsonableError(_('Invalid user ID {}').format(user_id))
        user_profiles.append(user_profile)
    do_send_typing_notification(realm=realm, sender=sender, recipient_user_profiles=user_profiles, operator=operator)
def check_send_typing_notification(sender: UserProfile, user_ids: List[int], operator: str) -> None:
    realm = sender.realm
    if (len(user_ids) == 0):
        raise JsonableError(_("Missing parameter: 'to' (recipient)"))
    elif (operator not in ('start', 'stop')):
        raise JsonableError(_("Invalid 'op' value (should be start or stop)"))
    ' The next chunk of code will go away when we upgrade old mobile\n    users away from versions of mobile that send emails.  For the\n    small number of very outdated mobile clients, we do double work\n    here in terms of fetching users, but this structure reduces lots\n    of other unnecessary duplicated code and will make it convenient\n    to mostly delete code when we desupport old versions of the\n    app.'
    if (sender.id not in user_ids):
        user_ids.append(sender.id)
    user_profiles = []
    for user_id in user_ids:
        try:
            user_profile = get_user_by_id_in_realm_including_cross_realm(user_id, sender.realm)
        except UserProfile.DoesNotExist:
            raise JsonableError(_('Invalid user ID {}').format(user_id))
        user_profiles.append(user_profile)
    do_send_typing_notification(realm=realm, sender=sender, recipient_user_profiles=user_profiles, operator=operator)