def do_change_password(user_profile: UserProfile, password: str, commit: bool=True) -> None:
    user_profile.set_password(password)
    if commit:
        user_profile.save(update_fields=['password'])
    event_time = timezone_now()
    RealmAuditLog.objects.create(realm=user_profile.realm, acting_user=user_profile, modified_user=user_profile, event_type=RealmAuditLog.USER_PASSWORD_CHANGED, event_time=event_time)
def do_change_password(user_profile: UserProfile, password: str, commit: bool=True) -> None:
    user_profile.set_password(password)
    if commit:
        user_profile.save(update_fields=['password'])
    event_time = timezone_now()
    RealmAuditLog.objects.create(realm=user_profile.realm, acting_user=user_profile, modified_user=user_profile, event_type=RealmAuditLog.USER_PASSWORD_CHANGED, event_time=event_time)