def getLineAfterText(text, prefix, startPos=0, includeText=False):
    """Extracts the remainder of a line after a prefix"""
    # StartPos = index in the text to start looking at
    
    # Find the prefix
    prefixLoc = text.find(prefix, startPos)
    if prefixLoc < 0:
        raise Exception('Desired text not found: ' + prefix)
    
    # Find the bounds after the prefix
    prefixEnd = prefixLoc + len(prefix)
    nextEnd   = text.find('\n', prefixEnd)
    if nextEnd == -1: # If there was no trailing \n, use one past last character.
        nextEnd = len(text) 

    # Check that we found the bounds
    if (prefixEnd < startPos) or (nextEnd <= prefixEnd):
        raise Exception('Desired text not found: ' + prefix)
    
    # Extract the text
    if includeText:
        return text[prefixLoc:nextEnd]
    else:
        return text[prefixEnd:nextEnd]