code: def _determine_timeout(default_timeout, specified_timeout, retry):
      
      if specified_timeout is DEFAULT:
          specified_timeout = default_timeout
  
      if specified_timeout is default_timeout:
          # If timeout is the default and the default timeout is exponential and
          # a non-default retry is specified, make sure the timeout's deadline
          # matches the retry's. This handles the case where the user leaves
          # the timeout default but specifies a lower deadline via the retry.
          if (
              retry
              and retry is not DEFAULT
              and isinstance(default_timeout, timeout.ExponentialTimeout)
          ):
              return default_timeout.with_deadline(retry._deadline)
          else:
              return default_timeout
  
      # If timeout is specified as a number instead of a Timeout instance,
      # convert it to a ConstantTimeout.
      if isinstance(specified_timeout, (int, float)):
          return timeout.ConstantTimeout(specified_timeout)
      else:
          return specified_timeout
docs: Determines how timeout should be applied to a wrapped method.
  
      Args:
          default_timeout (Optional[Timeout]): The default timeout specified
              at method creation time.
          specified_timeout (Optional[Timeout]): The timeout specified at
              invocation time. If :attr:`DEFAULT`, this will be set to
              the ``default_timeout``.
          retry (Optional[Retry]): The retry specified at invocation time.
  
      Returns:
          Optional[Timeout]: The timeout to apply to the method or ``None``.