code: func (c *CipdSpec) ToCipdInput() *swarm.SwarmingRpcsCipdInput {
  	if c == nil || c.Client == nil && len(c.ByPath) == 0 {
  		return nil
  	}
  	ret := &swarm.SwarmingRpcsCipdInput{
  		ClientPackage: c.Client.ToCipdPackage(),
  	}
  	if len(c.ByPath) > 0 {
  		count := 0
  		paths := make(sort.StringSlice, 0, len(c.ByPath))
  		for path, pkgs := range c.ByPath {
  			paths = append(paths, path)
  			count += len(pkgs.Pkg)
  		}
  		ret.Packages = make([]*swarm.SwarmingRpcsCipdPackage, 0, count)
  		for _, path := range paths {
  			for _, pkg := range c.ByPath[path].Pkg {
  				retPkg := pkg.ToCipdPackage()
  				retPkg.Path = path
  				ret.Packages = append(ret.Packages, retPkg)
  			}
  		}
  	}
  	return ret
  }
docs: // ToCipdInput converts this to a swarming api SwarmingRpcsCipdInput.