<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read_length_and_key(fp):
 """ Helper to read descriptor key. """

    length = read_fmt('I', fp)[0]
    key = fp.read(length or 4)
    if length == 0 and key not in _TERMS:
        logger.debug('Unknown term: %r' % (key))
        _TERMS.add(key)
    return key