def _get_secret_from_google_colab(name: str) -> Optional[str]:
    """Get token from Google Colab secrets vault using `google.colab.userdata.get(...)`.

    Token is read from the vault only once per session and then stored in a global variable to avoid re-requesting
    access to the vault.
    """
    # If it's not a Google Colab, fallback to environment variable
    if not is_google_colab():
        return None

    # `google.colab.userdata` is not thread-safe
    # This can lead to a deadlock if multiple threads try to access it at the same time
    # => use a lock
    # See https://github.com/huggingface/huggingface_hub/issues/1952 for more details.
    with _GOOGLE_COLAB_SECRET_LOCK:
        global _IS_GOOGLE_COLAB_CHECKED

        # we can add here some cache mechanism

        try:
            from google.colab import userdata
            from google.colab.errors import Error as ColabError
        except ImportError:
            return None

        try:
            # initialize to None in case of errors we evoid returning an undefined variable
            secret_value = None
            secret_value = _clean_secret_value(userdata.get(name))

        except userdata.NotebookAccessError:
            # Means the user has a secret call `ARGILLA_API_URL` and `ARGILLA_API_URL` and got a popup "please grand access to ARGILLA_API_URL" and refused it
            # => warn user but ignore error => do not re-request access to user
            if not _IS_GOOGLE_COLAB_CHECKED:
                warnings.warn(
                    f"\nAccess to the secret {name} has not been granted on this notebook."
                    "\nYou will not be requested again."
                    "\nPlease restart the session if you want to be prompted again."
                )
        except userdata.SecretNotFoundError:
            # Means the user did not define a name  secret => warn
            warnings.warn(f"\nThe secrets {name} and does not exist in your Colab secrets.")
        except ColabError as e:
            # Something happen but we don't know what => recommend to open a GitHub issue
            warnings.warn(
                f"\nError while fetching {name} secret value from your vault: '{str(e)}'."
                "\nYou are not authenticated with the Argilla in this notebook."
                "\nIf the error persists, please let us know by opening an issue on GitHub "
                "(https://github.com/argilla-io/argilla//issues/new)."
            )

        _IS_GOOGLE_COLAB_CHECKED = True

        return secret_value
Get token from Google Colab secrets vault using `google.colab.userdata.get(...)`.

    Token is read from the vault only once per session and then stored in a global variable to avoid re-requesting
    access to the vault.
    
argilla/src/argilla/_api/_token.py