'Returns a version string and True if a LAMEHeader follows.
The passed file object will be positioned right before the
lame header if True.
Raises LAMEError if there is no lame version info.'

@classmethod
def parse_version(cls, fileobj):

    data = fileobj.read(20)
    if (len(data) != 20):
        raise LAMEError('Not    a    lame    header')
    if (not data.startswith(('LAME', 'L3.99'))):
        raise LAMEError('Not    a    lame    header')
    data = data.lstrip('EMAL')
    (major, data) = (data[0:1], data[1:].lstrip('.'))
    minor = ''
    for c in iterbytes(data):
        if (not c.isdigit()):
            break
        minor += c
    data = data[len(minor):]
    try:
        major = int(major.decode('ascii'))
        minor = int(minor.decode('ascii'))
    except ValueError:
        raise LAMEError
    if (((major, minor) < (3, 90)) or (((major, minor) == (3, 90)) and (data[(-11):(-10)] == '('))):
        flag = data.strip('\x00').rstrip().decode('ascii')
        return ((major, minor), (u'%d.%d%s' % (major, minor, flag)), False)
    if (len(data) < 11):
        raise LAMEError('Invalid    version:    too    long')
    flag = data[:(-11)].rstrip('\x00')
    flag_string = u''
    patch = u''
    if (flag == 'a'):
        flag_string = u'    (alpha)'
    elif (flag == 'b'):
        flag_string = u'    (beta)'
    elif (flag == 'r'):
        patch = u'.1+'
    elif (flag == '    '):
        if ((major, minor) > (3, 96)):
            patch = u'.0'
        else:
            patch = u'.0+'
    elif ((flag == '') or (flag == '.')):
        patch = u'.0+'
    else:
        flag_string = u'    (?)'
    fileobj.seek((-11), 1)
    return ((major, minor), (u'%d.%d%s%s' % (major, minor, patch, flag_string)), True)
