code: def from_token(cls, api_token: Optional[str] = None) -> "Credentials":
      if api_token is None:
          api_token = os.getenv(API_TOKEN_ENV_NAME)
  
      if api_token == ANONYMOUS_API_TOKEN:
          api_token = ANONYMOUS_API_TOKEN_CONTENT
  
      if api_token is None:
          raise NeptuneMissingApiTokenException()
  
      api_token = api_token.strip()
      token_dict = Credentials._api_token_to_dict(api_token)
      # TODO: Consider renaming 'api_address' (breaking backward compatibility)
      if "api_address" not in token_dict:
          raise NeptuneInvalidApiTokenException()
      token_origin_address = token_dict["api_address"]
      api_url = (
          token_dict["api_url"] if "api_url" in token_dict else None
      )
  
      return Credentials(
          api_token=api_token,
          token_origin_address=token_origin_address,
          api_url_opt=api_url,
      )
  
file_path: neptune-client/src/neptune/internal/credentials.py
imports: import base64
  import json
  import os
  from dataclasses import dataclass
  from typing import Dict, Optional
  from neptune.common.envs import API_TOKEN_ENV_NAME
  from neptune.common.exceptions import NeptuneInvalidApiTokenException
  from neptune.constants import ANONYMOUS_API_TOKEN
  from neptune.exceptions import NeptuneMissingApiTokenException
  from neptune.internal.constants import ANONYMOUS_API_TOKEN_CONTENT
label_desc: Use image node_id 1 for calling the Credentials obj's underlying member method code with example usage: obj.from_token(cls, api_token) and returns: Credentials