def load_library_handle(libname, path):
if path is None or path in ['<STR_LIT:None>', '<STR_LIT:none>']:<EOL><INDENT>return None<EOL><DEDENT>try:<EOL><INDENT>if os.name == "<STR_LIT>":<EOL><INDENT>opj_lib = ctypes.windll.LoadLibrary(path)<EOL><DEDENT>else:<EOL><INDENT>opj_lib = ctypes.CDLL(path)<EOL><DEDENT><DEDENT>except (TypeError, OSError):<EOL><INDENT>msg = '<STR_LIT>'<EOL>msg = msg.format(path=path, libname=libname)<EOL>warnings.warn(msg, UserWarning)<EOL>opj_lib = None<EOL><DEDENT>return opj_lib<EOL>
Load the library, return the ctypes handle.