code: def _parse_statistic(data, scale):
          
          i = 0
          for byte in bytearray(data):
              i = (i << 8) + byte
  
          if i == 32768:
              return None
  
          if scale == 0:
              return i
  
          return float(i) / (scale * 10)
docs: Parse binary statistics returned from the history API