def splitbycharset(txt, charset):
    """Splits a string at the first occurrence of a character in a set.
    
    Args:
        txt: Text to split.
        chars: Chars to look for (specified as string).
        
    Returns:
        (char, before, after) where char is the character from the character
        set which has been found as first; before and after are the substrings
        before and after it. If none of the characters had been found in the
        text, char and after are set to the empty string and before to the 
        entrire string.
    """
    for firstpos, char in enumerate(txt):
        if char in charset:
            break
    else:
        return '',  txt, '' 
    return txt[firstpos], txt[:firstpos], txt[firstpos+1:]