<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _store_checkpoint(self, sess, saver, global_step):
 """Store a checkpoint if a log directory was provided to the constructor. The directory will be created if needed. Args: sess: Session containing variables to store. saver: Saver used for checkpointing. global_step: Step number of the checkpoint name. """

    if not self._logdir or not saver:
      return
    tf.gfile.MakeDirs(self._logdir)
    filename = os.path.join(self._logdir, 'model.ckpt')
    saver.save(sess, filename, global_step)