code: def _action_store(attrs, interactive, providers):
      # Determine the defaults to use for storing. In non-interactive mode,
      # this is what's going to be stored, in interactive mode user is
      # presented with them as default choice.
      # We don't really know what authentication type makes sense to store in
      # the provider config (this would be relevant for datalad using those
      # credentials w/o git).
      # However, pick 'http_basic_auth' in case of HTTP(S) URL and 'none'
      # otherwise as the default to pass into store routine.
      if attrs.get("protocol") in ["http", "https"]:
          authentication_type = "http_basic_auth"
      else:
          authentication_type = "none"
      # If we got a `path` component from git, usehttppath is set and thereby
      # git was instructed to include it when matching. Hence, do the same.
      url_re = "{pr}://{h}{p}.*".format(
          pr=attrs.get("protocol"),
          h=attrs.get("host"),
          p="/" + attrs.get("path") if "path" in attrs.keys() else "",
      )
      name = attrs.get("host")
      credential_name = name
      credential_type = "user_password"
      if not interactive:
          # TODO: What about credential labels? This could already exist as
          #       well. However, it's unlikely since the respective
          #       "service name" for keyring is prepended with "datalad-".
          #       For the same reason of how the keyring system is used by
          #       datalad it's not very transparently accessible what labels
          #       we'd need to check for. Rather than encoding knowledge about
          #       datalad's internal handling here, let's address that in
          #       datalad's provider and credential classes and have an easy
          #       check to be called from here.
          if any(p.name == name for p in providers):
              print(
                  f"Provider name '{name}' already exists. This can't be "
                  "resolved in non-interactive mode.",
                  file=sys.stderr,
              )
  
          authenticator_class = AUTHENTICATION_TYPES[
              authentication_type
          ]
          saved_provider = providers._store_new(
              url=attrs.get("url"),
              authentication_type=authentication_type,
              authenticator_class=authenticator_class,
              url_re=url_re,
              name=name,
              credential_name=credential_name,
              credential_type=credential_type,
              level="user",
          )
      else:
          # use backend made for annex special remotes for interaction from a
          # subprocess whose stdin/stdout are in use for communication with
          # its parent
          from datalad.ui import ui
  
          ui.set_backend("annex")
  
          # ensure default is first in list (that's how `enter_new` determines
          # it's the default)
          auth_list = AUTHENTICATION_TYPES.copy()
          auth_list.pop(authentication_type, None)
          auth_list = [authentication_type] + list(auth_list.keys())
  
          saved_provider = providers.enter_new(
              url=attrs.get("url"),
              auth_types=auth_list,
              url_re=url_re,
              name=name,
              credential_name=credential_name,
              credential_type=credential_type,
          )
      saved_provider.credential.set(
          user=attrs["username"], password=attrs["password"]
      )
  
imports: import sys
  from datalad.downloaders import GitCredential, UserPassword
  from datalad.downloaders.providers import AUTHENTICATION_TYPES, Providers
  from datalad.local.gitcredential import _credspec2dict
  from datalad import ConfigManager
label_desc: Use image node_id 2 for calling a global function with example usage: _action_store(attrs, interactive, providers) without return types