code: def test_write_to_and_read(default_model_storage: ModelStorage):
      test_filename = "file.txt"
      test_file_content = "hi"
  
      test_sub_filename = "sub_file"
      test_sub_dir_name = "sub_directory"
      test_sub_file_content = "sub file"
  
      resource = Resource("some_node123")
  
      # Fill model storage for resource
      with default_model_storage.write_to(
          resource
      ) as resource_directory:
          file = resource_directory / test_filename
          file.write_text(test_file_content)
  
          sub_directory = resource_directory / test_sub_dir_name
          sub_directory.mkdir()
          file_in_sub_directory = sub_directory / test_sub_filename
          file_in_sub_directory.write_text(test_sub_file_content)
  
      # Read written resource data from model storage to see whether all expected
      # content is there
      with default_model_storage.read_from(
          resource
      ) as resource_directory:
          assert (
              resource_directory / test_filename
          ).read_text() == test_file_content
          assert (
              resource_directory / test_sub_dir_name / test_sub_filename
          ).read_text() == test_sub_file_content
  
imports: import sys
  import uuid
  from datetime import datetime
  from pathlib import Path
  from tarsafe import TarSafe
  import freezegun
  import pytest
  from _pytest.monkeypatch import MonkeyPatch
  from _pytest.tmpdir import TempPathFactory
  import rasa.shared.utils.io
  from rasa.engine.graph import SchemaNode, GraphSchema, GraphModelConfiguration
  from rasa.engine.storage.local_model_storage import LocalModelStorage, MODEL_ARCHIVE_METADATA_FILE
  from rasa.engine.storage.storage import ModelStorage, ModelMetadata
  from rasa.engine.storage.resource import Resource
  from rasa.exceptions import UnsupportedModelVersionError
  from rasa.shared.core.domain import Domain
  from rasa.shared.data import TrainingType
  from tests.engine.graph_components_test_classes import PersistableTestComponent
label_desc: Use image node_id 1 for calling a global function with example usage: test_write_to_and_read(default_model_storage) without return types