code: def register_storage(
      self,
      provider: Optional[str] = None,
      tag: Optional[str] = None,
      is_default: bool = False,
      **settings,
  ):
      if provider is None:
          raise WorkflowError(
              'Storage provider must be specified (provider="...").'
          )
      if provider != provider.lower():
          raise WorkflowError("Storage provider must be lowercase.")
  
      # First retrieve plugin in order to ensure that it is there.
      plugin = StoragePluginRegistry().get_plugin(provider)
  
      tagged_settings = self.workflow.storage_provider_settings.get(
          provider
      )
      if tagged_settings is None:
          final_settings = None
      else:
          final_settings = tagged_settings.get_settings(tag)
      if final_settings is None and plugin.settings_cls is not None:
          final_settings = plugin.settings_cls()
  
      if final_settings is not None:
          final_settings = copy.copy(final_settings)
          final_settings.__dict__.update(**settings)
  
          plugin.validate_settings(final_settings)
  
      name = tag if tag else plugin.name
  
      local_prefix = (
          self.workflow.storage_settings.local_storage_prefix / name
      )
  
      if is_default and not (
          issubclass(
              plugin.storage_provider.get_storage_object_cls(),
              StorageObjectWrite,
          )
          and issubclass(
              plugin.storage_provider.get_storage_object_cls(),
              StorageObjectRead,
          )
      ):
          raise WorkflowError(
              "Default storage provider must be a read-write storage provider, but "
              f"{plugin.name} is not."
          )
  
      provider_instance = plugin.storage_provider(
          local_prefix=local_prefix,
          settings=final_settings,
          keep_local=self.workflow.storage_settings.keep_storage_local,
          is_default=is_default,
      )
      self._storages[name] = provider_instance
      return provider_instance
  
imports: import copy
  from typing import Any, Optional
  from snakemake.io import flag
  from snakemake.workflow import Workflow
  from snakemake_interface_common.exceptions import WorkflowError
  from snakemake_interface_storage_plugins.registry import StoragePluginRegistry
  from snakemake_interface_storage_plugins.storage_object import StorageObjectWrite, StorageObjectRead
  from snakemake.io import MaybeAnnotated
  from snakemake.common import __version__
label_desc: Use image node_id 3 for calling the StorageRegistry obj's underlying member method code with example usage: obj.register_storage(provider, tag, is_default) and returns: provider_instance