def _read_riff_chunk(fid):
    str1 = fid.read(4)
    if (str1 == b'RIFF'):
        is_big_endian = False
        fmt = '<I'
    elif (str1 == b'RIFX'):
        is_big_endian = True
        fmt = '>I'
    else:
        raise ValueError('File format {}... not understood.'.format(repr(str1)))
    file_size = (struct.unpack(fmt, fid.read(4))[0] + 8)
    str2 = fid.read(4)
    if (str2 != b'WAVE'):
        raise ValueError('Not a WAV file.')
    return (file_size, is_big_endian)
def _read_riff_chunk(fid):
    str1 = fid.read(4)
    if (str1 == b'RIFF'):
        is_big_endian = False
        fmt = '<I'
    elif (str1 == b'RIFX'):
        is_big_endian = True
        fmt = '>I'
    else:
        raise ValueError('File format {}... not understood.'.format(repr(str1)))
    file_size = (struct.unpack(fmt, fid.read(4))[0] + 8)
    str2 = fid.read(4)
    if (str2 != b'WAVE'):
        raise ValueError('Not a WAV file.')
    return (file_size, is_big_endian)