code: def checkpoint_filepath(checkpoint, pm):
      
  
      # Handle case in which checkpoint is given not just as a string, but
      # as a checkpoint-like filename. Don't worry about absolute path status
      # of a potential filename input, or whether it's in the pipeline's
      # output folder. That's handled upstream. While this isn't a protected
      # function, there's no real reason to call this from outside the package.
      if isinstance(checkpoint, str):
          if os.path.isabs(checkpoint):
              if is_in_file_tree(checkpoint, pm.outfolder):
                  return checkpoint
              else:
                  raise ValueError(
                      "Absolute checkpoint path '{}' is not in pipeline output "
                      "folder '{}'".format(checkpoint, pm.outfolder))
          _, ext = os.path.splitext(checkpoint)
          if ext == CHECKPOINT_EXTENSION:
              return pipeline_filepath(pm, filename=checkpoint)
  
      # Allow Pipeline as pm type without importing Pipeline.
      try:
          pm = pm.manager
      except AttributeError:
          pass
  
      # We want the checkpoint filename itself to become a suffix, with a
      # delimiter intervening between the pipeline name and the checkpoint
      # name + extension. This is to handle the case in which a single, e.g.,
      # sample's output folder is the destination for output from multiple
      # pipelines, and we thus want to be able to distinguish between
      # checkpoint files from different pipelines for that sample that may
      # well define one or more stages with the same name (e.g., trim_reads,
      # align_reads, etc.)
      chkpt_name = checkpoint_filename(checkpoint, pipeline_name=pm.name)
      return pipeline_filepath(pm, filename=chkpt_name)
docs: Create filepath for indicated checkpoint.
  
      :param str | pypiper.Stage checkpoint: Pipeline phase/stage or one's name
      :param pypiper.PipelineManager | pypiper.Pipeline pm: manager of a pipeline
          instance, relevant for output folder path.
      :return str: standardized checkpoint name for file, plus extension
      :raise ValueError: if the checkpoint is given as absolute path that does
          not point within pipeline output folder