Fix a potential use-after-free with library functions.
Fix a potential use-after-free with library functions.

Previously library functions did not retain a reference to the
library which they belong to.  This could result in a use-after-
free if an explicit reference was not kept to the library itself.

We now handle this by returning self as part of the function
tuple.

SuperBo/pyMIC,FreddieWitherden/pyMIC,mjklemm/pyMIC,01org/pyMIC,pombreda/pyMIC,FreddieWitherden/pyMIC,FreddieWitherden/pyMIC,01org/pyMIC,pombreda/pyMIC,01org/pyMIC,pombreda/pyMIC,mjklemm/pyMIC,SuperBo/pyMIC,SuperBo/pyMIC,seanjensengrey/pyMIC,seanjensengrey/pyMIC,SuperBo/pyMIC,mjklemm/pyMIC,seanjensengrey/pyMIC,FreddieWitherden/pyMIC,seanjensengrey/pyMIC,pombreda/pyMIC,01org/pyMIC,mjklemm/pyMIC