code: def _scaled_int(s):
      r
      s = bytearray(s)  # For Python 2
  
      # Get leftmost bit (sign) as 1 (if 0) or -1 (if 1)
      sign = 1 - ((s[0] & 0x80) >> 6)
  
      # Combine remaining bits
      int_val = (((s[0] & 0x7f) << 16) | (s[1] << 8) | s[2])
      log.debug('Source: %s Int: %x Sign: %d', ' '.join(hex(c) for c in s), int_val, sign)
  
      # Return scaled and with proper sign
      return (sign * int_val) / 10000.
docs: r"""Convert a 3 byte string to a signed integer value.