code: def before_sleep_func_accept_retry_state(fn):
      
      if not six.callable(fn):
          return fn
  
      if func_takes_retry_state(fn):
          return fn
  
      @_utils.wraps(fn)
      def wrapped_before_sleep_func(retry_state):
          # retry_object, sleep, last_result
          warn_about_non_retry_state_deprecation(
              'before_sleep', fn, stacklevel=4)
          return fn(
              retry_state.retry_object,
              sleep=getattr(retry_state.next_action, 'sleep'),
              last_result=retry_state.outcome)
      return wrapped_before_sleep_func
docs: Wrap "before_sleep" function to accept "retry_state".