def wrapinstance(ptr):
        # pointers for Qt should always be long integers
        ptr = long(ptr)
        # Get the pointer as a QObject, and use metaObject
        # to find a better type.
        qobj = shiboken.wrapInstance(ptr, QtCore.QObject)
        metaobj = qobj.metaObject()
        # Look for the real class in qt namespaces.
        # If not found, walk up the hierarchy.
        # When we reach the top of the Qt hierarchy,
        # we'll break out of the loop since we'll eventually
        # reach QObject.
        realcls = None
        while realcls is None:
            realcls = _getcls(metaobj.className())
            metaobj = metaobj.superClass()
        # Finally, return the same pointer/object
        # as its most specific type.
        return shiboken.wrapInstance(ptr, realcls)
Converts a pointer (int or long) into the concrete
dataset/ETHPy150Open rgalanakis/practicalmayapython/src/chapter5/qtshim.py/wrapinstance