Unwrap and return the object referenced by a proxy.

        This function is very similar to :func:`get_reference`, but works for
        both proxies and regular objects. If the specified object is a proxy,
        its reference is extracted with ``get_reference`` and returned. If it
        is not a proxy, it is returned as is.

        If the object references by the proxy is itself a proxy, the unwrapping
        is repeated until a regular (non-proxy) object is found.

        possible_proxy:
            object that might or might not be a proxy.

def unproxy(possible_proxy):
        '''
        Unwrap and return the object referenced by a proxy.

        This function is very similar to :func:`get_reference`, but works for
        both proxies and regular objects. If the specified object is a proxy,
        its reference is extracted with ``get_reference`` and returned. If it
        is not a proxy, it is returned as is.

        If the object references by the proxy is itself a proxy, the unwrapping
        is repeated until a regular (non-proxy) object is found.

        possible_proxy:
            object that might or might not be a proxy.
        '''
        while isinstance(possible_proxy, ThreadLocalProxy):
            possible_proxy = ThreadLocalProxy.get_reference(possible_proxy)
        return possible_proxy