def parse(string, start, divider, type=str):
    """general purpose tokenizer, used below"""
    if string.startswith(start):
        string = string[len(start):]
        try:
            result, string = string.split(divider, 1)
        except ValueError:
            result, string = string, ''
    else:
        result = None
    if result is not None:
        result = type(result)
    return result, string
