<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wrap_warnings(logger):
 """Have the function patch `warnings.showwarning` with the given logger. Arguments: logger (~logging.logger):
 the logger to wrap warnings with when the decorated function is called. Returns: `function`: a decorator function. """

    def decorator(func):
        @functools.wraps(func)
        def new_func(*args, **kwargs):
            showwarning = warnings.showwarning
            warnings.showwarning = warn_logging(logger)
            try:
                return func(*args, **kwargs)
            finally:
                warnings.showwarning = showwarning
        return new_func
    return decorator