throw userwarning exception python code example Example: python suppress warnings in function import warnings warnings.filterwarnings("ignore")