def _is_registry(text: Optional[_PATH]) -> bool:
    """Check if a string equals 'registry' or starts with 'registry:'.

    Args:
        text: The string to check

    >>> _is_registry("registry")
    True
    >>> _is_registry("REGISTRY:model-name")
    True
    >>> _is_registry("something_registry")
    False
    >>> _is_registry("")
    False

    """
    if not isinstance(text, str):
        return False

    # Pattern matches exactly 'registry' or 'registry:' followed by any characters
    pattern = r"^registry(:.*|$)"
    return bool(re.match(pattern, text.lower()))
Check if a string equals 'registry' or starts with 'registry:'.

    Args:
        text: The string to check

    >>> _is_registry("registry")
    True
    >>> _is_registry("REGISTRY:model-name")
    True
    >>> _is_registry("something_registry")
    False
    >>> _is_registry("")
    False

    
src/lightning/pytorch/utilities/model_registry.py