code: def checkNewCheckpointsAreLeafVertices(self):
          
          roots = self.getRootJobs() # Roots jobs of component, these are preexisting jobs in the graph
  
          # All jobs in the component of the job graph containing self
          jobs = set()
          list(map(lambda x : x._dfs(jobs), roots))
  
          # Check for each job for which checkpoint is true that it is a cut vertex or leaf
          for y in [x for x in jobs if x.checkpoint]:
              if y not in roots: # The roots are the prexisting jobs
                  if not Job._isLeafVertex(y):
                      raise JobGraphDeadlockException("New checkpoint job %s is not a leaf in the job graph" % y)
docs: A checkpoint job is a job that is restarted if either it fails, or if any of \
          its successors completely fails, exhausting their retries.
  
          A job is a leaf it is has no successors.
  
          A checkpoint job must be a leaf when initially added to the job graph. When its \
          run method is invoked it can then create direct successors. This restriction is made
          to simplify implementation.
  
          :raises toil.job.JobGraphDeadlockException: if there exists a job being added to the graph for which \
          checkpoint=True and which is not a leaf.