def stop(self):
        """Starts a graceful stop of the crawler and returns a deferred that is
        fired when the crawler is stopped."""
        if self.crawling:
            self.crawling = False
            yield defer.maybeDeferred(self.engine.stop)
Starts a graceful stop of the crawler and returns a deferred that is
        fired when the crawler is stopped.
stackoverflow/venv/lib/python3.6/site-packages/scrapy/crawler.py