code: def _isCheckpointDir(checkpointDir):
    
    lastSegment = os.path.split(checkpointDir)[1]
    if lastSegment[0] == '.':
      return False
  
    if not checkpointDir.endswith(g_defaultCheckpointExtension):
      return False
  
    if not os.path.isdir(checkpointDir):
      return False
  
    return True
docs: Return true iff checkpointDir appears to be a checkpoint directory.