code: def scaled(values, output_min, output_max, input_min=0, input_max=1):
      
      values = _normalize(values)
      if input_min >= input_max:
          raise ValueError('input_min must be smaller than input_max')
      input_size = input_max - input_min
      output_size = output_max - output_min
      for v in values:
          yield (((v - input_min) / input_size) * output_size) + output_min
docs: Returns *values* scaled from *output_min* to *output_max*, assuming that
      all items in *values* lie between *input_min* and *input_max* (which
      default to 0 and 1 respectively). For example, to control the direction of
      a motor (which is represented as a value between -1 and 1) using a
      potentiometer (which typically provides values between 0 and 1)::
  
          from gpiozero import Motor, MCP3008
          from gpiozero.tools import scaled
          from signal import pause
  
          motor = Motor(20, 21)
          pot = MCP3008(channel=0)
  
          motor.source = scaled(pot, -1, 1)
  
          pause()
  
      .. warning::
  
          If *values* contains elements that lie outside *input_min* to
          *input_max* (inclusive) then the function will not produce values that
          lie within *output_min* to *output_max* (inclusive).