code: public PathTemplate subTemplate(String varName) {
      List<Segment> sub = Lists.newArrayList();
      boolean inBinding = false;
      for (Segment seg : segments) {
        if (seg.kind() == SegmentKind.BINDING && seg.value().equals(varName)) {
          inBinding = true;
        } else if (inBinding) {
          if (seg.kind() == SegmentKind.END_BINDING) {
            return PathTemplate.create(toSyntax(sub, true), urlEncoding);
          } else {
            sub.add(seg);
          }
        }
      }
      throw new ValidationException(
          String.format("Variable '%s' is undefined in template '%s'", varName, this.toRawString()));
    }
docs: Returns a path template for the sub-path of the given variable. Example: <pre>
  PathTemplate template = PathTemplate.create("v1/{name=shelves/*&#47;books/*}");
  assert template.subTemplate("name").toString().equals("shelves/*&#47;books/*");
  </pre>
  
  The returned template will never have named variables, but only wildcards, which are dealt with
  in matching and instantiation using '$n'-variables. See the documentation of {@link
  #match(String)} and {@link #instantiate(Map)}, respectively.
  
  <p>For a variable which has no sub-path, this returns a path template with a single wildcard
  ('*').
  
  @throws ValidationException if the variable does not exist in the template.