https://mysteryweevil.medium.com/unlocking-the-power-of-generators-mastering-the-close-method-in-python-e4d6c48574af