def class_partition(cls, string):
    """Given a set of characters and a string, take the longest prefix made up of
    the characters in the set, and return a tuple of (prefix, remainder).

    """
    ns = string.lstrip(cls)
    lc = len(string) - len(ns)
    return (string[:lc], string[lc:])