CacheSerializableRunnable getCacheSerializableRunnableForPRColocatedCreate(
      final String regionName, final int redundancy, final String coloRegionName) {

    SerializableRunnable createPrRegion = new CacheSerializableRunnable(regionName) {
      @Override
      public void run2() throws CacheException {

        Cache cache = getCache();
        Region partitionedregion = null;
        try {
          Region colocatedRegion = cache.getRegion(coloRegionName);
          assertNotNull(colocatedRegion);
          AttributesFactory attr = new AttributesFactory();

          PartitionAttributesFactory paf = new PartitionAttributesFactory();
          PartitionAttributes prAttr = paf.setRedundantCopies(redundancy)
              .setColocatedWith(colocatedRegion.getFullPath()).create();
          attr.setPartitionAttributes(prAttr);

          partitionedregion = cache.createRegion(regionName, attr.create());
        } catch (IllegalStateException ex) {
          LogWriterUtils.getLogWriter().warning(
              "PRQueryDUnitHelper#getCacheSerializableRunnableForPRCreateWithRedundancy: Creation caught IllegalStateException",
              ex);
        }
        assertNotNull(
            "PRQueryDUnitHelper#getCacheSerializableRunnableForPRCreateWithRedundancy: Partitioned Region "
                + regionName + " not in cache",
            cache.getRegion(regionName));
        assertNotNull(
            "PRQueryDUnitHelper#getCacheSerializableRunnableForPRCreateWithRedundancy: Partitioned Region ref null",
            partitionedregion);
        assertTrue(
            "PRQueryDUnitHelper#getCacheSerializableRunnableForPRCreateWithRedundancy: Partitioned Region ref claims to be destroyed",
            !partitionedregion.isDestroyed());
      }
    };

    return (CacheSerializableRunnable) createPrRegion;
  }
This function creates a colocated region PR given the oher colocated region.

@return cacheSerializable object
geode-core/src/distributedTest/java/org/apache/geode/cache/query/partitioned/PRQueryDUnitHelper.java