def unpack(buf, offset, value_range):
    """
    Unpack bytes into python values.
    """
    result = 0
    for i in value_range:
        result = (result << 8) | str_to_ord(buf[offset + i])
    return result