Revert "_ctypes: don't cache library, bug #448858"

This reverts commit 9e37cca4f54260bd8c45a3041fcee00938c71649.
As noted in bug #448858, comment #14, dlclose is not called
automatically, so we may as well cache our library handles.
In order to protect ourselves, we use a fork since commit
7ebb2f54877edb28621c33e380f8777b1b1dc201.
diff --git a/pym/portage/util/_ctypes.py b/pym/portage/util/_ctypes.py
index f419b19..4e5aa2a 100644
--- a/pym/portage/util/_ctypes.py
+++ b/pym/portage/util/_ctypes.py
@@ -31,15 +31,17 @@
 		return None
 	return filename
 
+_library_handles = {}
+
 def LoadLibrary(name):
 	"""
 	Calls ctypes.cdll.LoadLibrary(name) if the ctypes module is available,
-	and otherwise returns None. Results are not cached, since that can
-	cause problems when libraries are updated (see bug #448858).
+	and otherwise returns None. Results are cached for future invocations.
 	"""
-	handle = None
+	handle = _library_handles.get(name)
 
-	if ctypes is not None:
+	if handle is None and ctypes is not None:
 		handle = ctypes.cdll.LoadLibrary(name)
+		_library_handles[name] = handle
 
 	return handle