code: public final boolean hasMatchingEnvVars(Map<String,String> modelEnvVar) {
              if(modelEnvVar.isEmpty())
                  // sanity check so that we don't start rampage.
                  return false;
  
              SortedMap<String,String> envs = getEnvironmentVariables();
              for (Entry<String,String> e : modelEnvVar.entrySet()) {
                  String v = envs.get(e.getKey());
                  if(v==null || !v.equals(e.getValue()))
                      return false;   // no match
              }
  
              return true;
          }
docs: Given the environment variable of a process and the "model environment variable" that Hudson
  used for launching the build, returns true if there's a match (which means the process should
  be considered a descendant of a build.)