code: def cleanup(self, keep=5):
          
          releases = self.get_releases()
          current_version = self.get_current_release()
          to_delete = [version for version in releases[keep:] if version != current_version]
  
          for release in to_delete:
              self._runner.run("rm -rf '{0}'".format(os.path.join(self._releases, release)))
docs: Remove all but the ``keep`` most recent releases.
  
          If any of the candidates for deletion are pointed to by the
          'current' symlink, they will not be deleted.
  
          This method performs N + 2 network operations where N is the
          number of old releases that are cleaned up.
  
          :param int keep: Number of old releases to keep around