public static Vertex getHostingVertex(final Object object) {
        Object obj = object;
        while (true) {
            if (obj instanceof Vertex)
                return (Vertex) obj;
            else if (obj instanceof Edge)
                return ((Edge) obj).outVertex();
            else if (obj instanceof Property)
                obj = ((Property) obj).element();
            else
                throw new IllegalStateException("The host of the object is unknown: " + obj.toString() + ':' + obj.getClass().getCanonicalName());
        }
    }
Extracts the {@link Vertex} that is holding the specified object.

@throws IllegalStateException if the object is not a graph element type
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/util/Host.java