def get_pair(offset,data):
    """ Extract a name/value pair from the data at offset. """
    if ord(data[offset])==0:
        # End of record
        # Return (None, None, offset of next record)
        return (None, None, offset+2)
    rlen = ord(data[offset])-1 # Record length
    nlen = ord(data[offset+2]) # Name length
    vlen = rlen-nlen # Value length
    offset = offset+3 # Skip to the name
    name = data[offset:offset+nlen]
    offset = offset+nlen # Skip to the value
    value = data[offset:offset+vlen]
    # Return (name, value, offset of next pair)
    return (name, value, offset+vlen)