code: def wrap_warnings(logger):
      
      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
docs: 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.