def reset_user_api_key(user_profile: Any) -> None:
    old_api_key = user_profile.api_key
    user_profile.api_key = generate_api_key()
    cache_delete(user_profile_by_api_key_cache_key(old_api_key))
    event = {'type': 'clear_push_device_tokens', 'user_profile_id': user_profile.id}
    queue_json_publish('deferred_work', event)
def reset_user_api_key(user_profile: Any) -> None:
    old_api_key = user_profile.api_key
    user_profile.api_key = generate_api_key()
    cache_delete(user_profile_by_api_key_cache_key(old_api_key))
    event = {'type': 'clear_push_device_tokens', 'user_profile_id': user_profile.id}
    queue_json_publish('deferred_work', event)