(capture)
If capture is true, redirect all warnings to the logging package.
    If capture is False, ensure that warnings are not redirected to logging
    but to their original destinations.
If capture is true, redirect all warnings to the logging package.
    If capture is False, ensure that warnings are not redirected to logging
    but to their original destinations.
If capture is true redirect all warnings to the logging package . If capture is False ensure that warnings are not redirected to logging but to their original destinations .
def captureWarnings(capture):
    """
    If capture is true, redirect all warnings to the logging package.
    If capture is False, ensure that warnings are not redirected to logging
    but to their original destinations.
    """
    global _warnings_showwarning
    if capture:
        if _warnings_showwarning is None:
            _warnings_showwarning = warnings.showwarning
            warnings.showwarning = _showwarning
    else:
        if _warnings_showwarning is not None:
            warnings.showwarning = _warnings_showwarning
            _warnings_showwarning = None
def captureWarnings ( capture ) : global _warnings_showwarning if capture : if _warnings_showwarning is None : _warnings_showwarning = warnings . showwarning warnings . showwarning = _showwarning else : if _warnings_showwarning is not None : warnings . showwarning = _warnings_showwarning _warnings_showwarning = None