code: public static <T> T copy(T from, Kryo kryo, TypeSerializer<T> serializer) {
  		try {
  			return kryo.copy(from);
  		} catch (KryoException ke) {
  			// Kryo could not copy the object --> try to serialize/deserialize the object
  			try {
  				byte[] byteArray = InstantiationUtil.serializeToByteArray(serializer, from);
  
  				return InstantiationUtil.deserializeFromByteArray(serializer, byteArray);
  			} catch (IOException ioe) {
  				throw new RuntimeException("Could not copy object by serializing/deserializing" +
  					" it.", ioe);
  			}
  		}
  	}
docs: Tries to copy the given record from using the provided Kryo instance. If this fails, then
  the record from is copied by serializing it into a byte buffer and deserializing it from
  there.
  
  @param from Element to copy
  @param kryo Kryo instance to use
  @param serializer TypeSerializer which is used in case of a Kryo failure
  @param <T> Type of the element to be copied
  @return Copied element