human
Write me a the Python code you requested given the following:
Complete the below
def if_matplotlib(func):

    ''''Test decorator that skips test if matplotlib not installed.'
    '''
assistant
#Here is the Python code you requested.
    @wraps(func)
    def run_test(*args, **kwargs):
        try:
            import matplotlib
            matplotlib.use('Agg', warn=False)
            import matplotlib.pyplot as plt
            plt.figure()
        except ImportError:
            raise SkipTest('Matplotlib    not    available.')
        else:
            return func(*args, **kwargs)
    return run_test