BKE_lib_id_make_local
Mixing testing and actual action in a single function is just not a good way to do things, and the 'testing' feature is not used anywhere anymore, time to get rid of it.