def validate_for_algorithm(self, algorithm):
        """
        Checks that all the necessary invariants of this (mode, algorithm)
        combination are met.
        """

        Checks that all the necessary invariants of this (mode, algorithm)
        combination are met.
        
stackoverflow/venv/lib/python3.6/site-packages/cryptography/hazmat/primitives/ciphers/modes.py