code: def _db_for_path(path=None):
      if path is not_set:
          if (
              os.getenv("HYPOTHESIS_DATABASE_FILE") is not None
          ):  # pragma: no cover
              raise HypothesisException(
                  "The $HYPOTHESIS_DATABASE_FILE environment variable no longer has any "
                  "effect.  Configure your database location via a settings profile instead.\n"
                  "https://hypothesis.readthedocs.io/en/latest/settings.html#settings-profiles"
              )
  
          path = storage_directory("examples")
          if not _usable_dir(path):  # pragma: no cover
              warnings.warn(
                  HypothesisWarning(
                      "The database setting is not configured, and the default "
                      "location is unusable - falling back to an in-memory "
                      "database for this session.  path=%r" % (path,)
                  )
              )
              return InMemoryExampleDatabase()
      if path in (None, ":memory:"):
          return InMemoryExampleDatabase()
      return DirectoryBasedExampleDatabase(str(path))
  
imports: from __future__ import absolute_import, division, print_function
  import binascii
  import os
  import warnings
  from hashlib import sha384
  from hypothesis.configuration import mkdir_p, storage_directory
  from hypothesis.errors import HypothesisException, HypothesisWarning
  from hypothesis.internal.compat import hbytes
  from hypothesis.utils.conventions import not_set
label_desc: Use image node_id 2 for calling a global function with example usage: _db_for_path(path) and returns: DirectoryBasedExampleDatabase, InMemoryExampleDatabase, InMemoryExampleDatabase