Helper for the line parser.

    If key is a prefix of line, will remove ir from the line and will
    extract the value (space separation), and the rest of the line.

    If use_rest is True, the value will be the rest of the line.

    Return a tuple with the value and the rest of the line.

def _pop(line, key, use_rest):
    '''
    Helper for the line parser.

    If key is a prefix of line, will remove ir from the line and will
    extract the value (space separation), and the rest of the line.

    If use_rest is True, the value will be the rest of the line.

    Return a tuple with the value and the rest of the line.
    '''
    value = None
    if line.startswith(key):
        line = line[len(key):].strip()
        if use_rest:
            value = line
            line = ''
        else:
            value, line = line.split(' ', 1)
    return value, line.strip()