code: func getJobInState(c context.Context, id JobID, states ...State) (*Job, error) {
  	job, err := getJob(c, id)
  	if err != nil {
  		return nil, errors.Reason("failed to fetch job with ID %d", id).Err()
  	}
  	for _, s := range states {
  		if job.State == s {
  			return job, nil
  		}
  	}
  	logging.Warningf(c, "Skipping the job: its state is %s, expecting one of %q", job.State, states)
  	return nil, nil
  }
docs: // getJobInState fetches a Job entity and checks its state.
  //
  // Returns:
  //   (*Job, nil) if the job is there and its state matches one of given states.
  //   (nil, nil) if the job is there, but in a different state.
  //   (nil, transient error) on datastore fetch errors.
  //   (nil, fatal error) if there's no such job at all.