code: public static Query toQuery(Object o, Query defaultValue) {
  	if (o instanceof Query) return (Query) o;
  	else if (o instanceof ObjectWrap) {
  	    return toQuery(((ObjectWrap) o).getEmbededObject(defaultValue), defaultValue);
  	}
  	return defaultValue;
      }
docs: cast a Object to a Query Object
  
  @param o Object to cast
  @param defaultValue
  @return casted Query Object