code: def _nda_adapter(composite, user=None, password=None):
      from datalad.support.third.nda_aws_token_generator import (
          NDATokenGenerator,
      )
      from .. import cfg
  
      nda_auth_url = cfg.obtain("datalad.externals.nda.dbserver")
      gen = NDATokenGenerator(nda_auth_url)
      lgr.debug(
          "Generating token for NDA user %s using %s talking to %s",
          user,
          gen,
          nda_auth_url,
      )
      try:
          token = gen.generate_token(user, password)
      except Exception as exc:  # it is really just an "Exception"
          exc_str = str(exc).lower()
          # ATM it is "Invalid username and/or password"
          # but who knows what future would bring
          if "invalid" in exc_str and (
              "user" in exc_str or "password" in exc_str
          ):
              raise AccessDeniedError(exc_str)
          raise
      # There are also session and expiration we ignore... TODO anything about it?!!!
      # we could create a derived AWS_S3 which would also store session and expiration
      # and then may be Composite could use those????
      return dict(
          key_id=token.access_key,
          secret_id=token.secret_key,
          session=token.session,
          expiration=token.expiration,
      )
  
imports: import time
  from ..support.exceptions import AccessDeniedError, CapturedException
  from ..support.keyring_ import keyring
  from ..ui import ui
  from ..utils import auto_repr
  from ..support.network import iso8601_to_epoch
  from datalad import cfg
  from datalad.config import anything2bool
  from datalad.distribution.dataset import Dataset
  from datalad.local.gitcredential import GitCredentialInterface
  from logging import getLogger
label_desc: Use image node_id 1 for calling a global function with example usage: _nda_adapter(composite, user, password) and returns: dict