Does anyone know how to suppress warnings from BioPython? Specifically, the Experimental warning from the use of SearchIO?

[This][1] script is perfectly functional, but I'd like to get rid of the annoying message about SearchIO - I'm using it for such a basic function that I'm not concerned that it's still experimental


  [1]: https://github.com/jrjhealey/bioinfo-tools/blob/master/Genbank_slicer.py


I've tried:

    >>> import warnings
    >>> from Bio import BiopythonWarning
    >>> warnings.simplefilter('ignore', BiopythonWarning)

as per the BioPython website, but that doesn't work in this case. Changing to BiopythonExperimentalWarning isn't correct either.
With some help from Peter Cock on twitter, it turns out that `warnings.catch_warnings():`, is the correct way to go, but it should be around the module import, not the function call:

    # Import SearchIO and suppress experimental warning
    from Bio import BiopythonExperimentalWarning
    with warnings.catch_warnings():
    	warnings.simplefilter('ignore', BiopythonExperimentalWarning)
    	from Bio import SearchIO