code: def safe_wraps(wrapper, *args, **kwargs):
      
      while isinstance(wrapper, functools.partial):
          wrapper = wrapper.func
      return functools.wraps(wrapper, *args, **kwargs)
docs: Safely wraps partial functions.