docs: def open_book(self, for_writing=False) -> piecash.Book:
          """
          Opens the database. Call this using 'with'.
          If database file is not found, an in-memory database will be created.
          """
          filename = None
  
          # check if the file path is already a URL.
          file_url = urllib.parse.urlparse(self.filename)
          if file_url.scheme == "file" or file_url.scheme == "sqlite":
              filename = file_url.path[1:]
          else:
              filename = self.filename
  
          if not os.path.isfile(filename):
              log(WARN, "Database %s requested but not found. Creating an in-memory book.", filename)
              return self.create_book()
  
          access_type = "read/write" if for_writing else "readonly"
          log(INFO, "Using %s in %s mode.", filename, access_type)
          # file_path = path.relpath(self.filename)
          file_path = path.abspath(filename)
  
          if not for_writing:
              book = piecash.open_book(file_path, open_if_lock=True)
          else:
              book = piecash.open_book(file_path, open_if_lock=True, readonly=False)
          # book = create_book()
          return book