def _get_best_registry() -> str:
    """Get the best registry based on latency.

    Returns:
        The best registry.
    """
    console.debug("Getting best registry...")
    registries = [
        ("https://registry.npmjs.org", 1),
        ("https://registry.npmmirror.com", 2),
    ]

    best_registry = min(registries, key=lambda x: average_latency(x[0]) * x[1])[0]
    console.debug(f"Best registry: {best_registry}")
    return best_registry
Get the best registry based on latency.

    Returns:
        The best registry.
    
reflex/utils/registry.py