def _next_term(text: str, openmetrics: bool) -> Tuple[str, str]:
    """Extract the next comma-separated label term from the text.
    
    Returns the stripped term and the stripped remainder of the string, 
    including the comma.
    
    Raises ValueError if the term is empty and we're in openmetrics mode.
    """
    
    # There may be a leading comma, which is fine here.
    if text[0] == ',':
        text = text[1:]
        if not text:
            return "", ""
        if text[0] == ',':
            raise ValueError("multiple commas")
    splitpos = _next_unquoted_char(text, ',}')
    if splitpos == -1:
        splitpos = len(text)
    term = text[:splitpos]
    if not term and openmetrics:
        raise ValueError("empty term:", term)
    
    sublabels = text[splitpos:]
    return term.strip(), sublabels.strip()
Extract the next comma-separated label term from the text.

Returns the stripped term and the stripped remainder of the string,
including the comma.

Raises ValueError if the term is empty and we're in openmetrics mode.
prometheus_client/parser.py