def is_prefixed(text: str, prefix: str) -> bool:
    """Check if a text (assumed to be a token value) is prefixed with a given prefix.

    This is different from simple checking text.startswith(prefix),
    because it also applies criteria normally applied by tokenizer to separate tokens.

    E.g. "acc loop" is prefixed with "acc", but "accelerate" is not.
    """
    if not text.startswith(prefix):
        return False
    if len(text) == len(prefix) or prefix[-1] == ':':
        return True
    return any(text[len(prefix):].startswith(_) for _ in (' ', '('))