code: public static <U> Task<U> withRetryPolicy(String name, RetryPolicy policy, Function1<Integer, Task<U>> taskFunction) {
      RetriableTask<U> retriableTask = new RetriableTask<>(name, policy, taskFunction);
      Task<U> retryTaskWrapper = Task.async(name + " retriableTask", retriableTask::run);
      retryTaskWrapper.getShallowTraceBuilder().setTaskType(TaskType.WITH_RETRY.getName());
      return retryTaskWrapper;
    }
docs: A helper for creating task wrapper with associated retry policy.
  
  @param name A name of the task that needs to be retried.
  @param policy Retry policy that will control this task's behavior.
  @param taskFunction A task generator function. It will receive a zero-based attempt number as a parameter.
  @param <U> Type of a task result.