prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Apply lazy import for `optuna.dashboard`.
  Optuna always imports the dependencies of `optuna.dashboard` (e.g., `bokeh`), which makes unnecessary overhead in many use cases. Similar to #334, we can apply lazy import for them.
  
  </issue>
  <code>
  [start of optuna/__init__.py]
  1 from optuna import dashboard  # NOQA
  2 from optuna import distributions  # NOQA
  3 from optuna import exceptions  # NOQA
  4 from optuna import importance  # NOQA
  5 from optuna import integration  # NOQA
  6 from optuna import logging  # NOQA
  7 from optuna import pruners  # NOQA
  8 from optuna import samplers  # NOQA
  9 from optuna import storages  # NOQA
  10 from optuna import structs  # NOQA
  11 from optuna import study  # NOQA
  12 from optuna import trial  # NOQA
  13 from optuna import version  # NOQA
  14 from optuna import visualization  # NOQA
  15 
  16 from optuna.study import create_study  # NOQA
  17 from optuna.study import delete_study  # NOQA
  18 from optuna.study import get_all_study_summaries  # NOQA
  19 from optuna.study import load_study  # NOQA
  20 from optuna.study import Study  # NOQA
  21 from optuna.trial import Trial  # NOQA
  22 from optuna.version import __version__  # NOQA
  23
  [end of optuna/__init__.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/optuna/__init__.py b/optuna/__init__.py
  --- a/optuna/__init__.py
  +++ b/optuna/__init__.py
  @@ -1,4 +1,6 @@
  -from optuna import dashboard  # NOQA
  +import importlib
  +import types
  +
   from optuna import distributions  # NOQA
   from optuna import exceptions  # NOQA
   from optuna import importance  # NOQA
  @@ -20,3 +22,37 @@
   from optuna.study import Study  # NOQA
   from optuna.trial import Trial  # NOQA
   from optuna.version import __version__  # NOQA
  +from optuna.type_checking import TYPE_CHECKING  # NOQA
  +
  +
  +if TYPE_CHECKING:
  +    from optuna import dashboard  # NOQA
  +else:
  +    from typing import Any
  +
  +    class _LazyImport(types.ModuleType):
  +        """Module wrapper for lazy import.
  +
  +        This class wraps specified module and lazily import it when they are actually accessed.
  +        Otherwise, `import optuna` becomes slower because it imports all submodules and
  +        their dependencies (e.g., bokeh) all at once.
  +        Within this project's usage, importlib override this module's attribute on the first
  +        access and the imported submodule is directly accessed from the second access.
  +
  +        Args:
  +            name: Name of module to apply lazy import.
  +        """
  +
  +        def __init__(self, name: str) -> None:
  +            super(_LazyImport, self).__init__(name)
  +            self._name = name
  +
  +        def _load(self) -> types.ModuleType:
  +            module = importlib.import_module(self._name)
  +            self.__dict__.update(module.__dict__)
  +            return module
  +
  +        def __getattr__(self, item: str) -> Any:
  +            return getattr(self._load(), item)
  +
  +    dashboard = _LazyImport("optuna.dashboard")
  
verification_info: {"golden_diff": "diff --git a/optuna/__init__.py b/optuna/__init__.py\n--- a/optuna/__init__.py\n+++ b/optuna/__init__.py\n@@ -1,4 +1,6 @@\n-from optuna import dashboard  # NOQA\n+import importlib\n+import types\n+\n from optuna import distributions  # NOQA\n from optuna import exceptions  # NOQA\n from optuna import importance  # NOQA\n@@ -20,3 +22,37 @@\n from optuna.study import Study  # NOQA\n from optuna.trial import Trial  # NOQA\n from optuna.version import __version__  # NOQA\n+from optuna.type_checking import TYPE_CHECKING  # NOQA\n+\n+\n+if TYPE_CHECKING:\n+    from optuna import dashboard  # NOQA\n+else:\n+    from typing import Any\n+\n+    class _LazyImport(types.ModuleType):\n+        \"\"\"Module wrapper for lazy import.\n+\n+        This class wraps specified module and lazily import it when they are actually accessed.\n+        Otherwise, `import optuna` becomes slower because it imports all submodules and\n+        their dependencies (e.g., bokeh) all at once.\n+        Within this project's usage, importlib override this module's attribute on the first\n+        access and the imported submodule is directly accessed from the second access.\n+\n+        Args:\n+            name: Name of module to apply lazy import.\n+        \"\"\"\n+\n+        def __init__(self, name: str) -> None:\n+            super(_LazyImport, self).__init__(name)\n+            self._name = name\n+\n+        def _load(self) -> types.ModuleType:\n+            module = importlib.import_module(self._name)\n+            self.__dict__.update(module.__dict__)\n+            return module\n+\n+        def __getattr__(self, item: str) -> Any:\n+            return getattr(self._load(), item)\n+\n+    dashboard = _LazyImport(\"optuna.dashboard\")\n", "issue": "Apply lazy import for `optuna.dashboard`.\nOptuna always imports the dependencies of `optuna.dashboard` (e.g., `bokeh`), which makes unnecessary overhead in many use cases. Similar to #334, we can apply lazy import for them.\n", "before_files": [{"content": "from optuna import dashboard  # NOQA\nfrom optuna import distributions  # NOQA\nfrom optuna import exceptions  # NOQA\nfrom optuna import importance  # NOQA\nfrom optuna import integration  # NOQA\nfrom optuna import logging  # NOQA\nfrom optuna import pruners  # NOQA\nfrom optuna import samplers  # NOQA\nfrom optuna import storages  # NOQA\nfrom optuna import structs  # NOQA\nfrom optuna import study  # NOQA\nfrom optuna import trial  # NOQA\nfrom optuna import version  # NOQA\nfrom optuna import visualization  # NOQA\n\nfrom optuna.study import create_study  # NOQA\nfrom optuna.study import delete_study  # NOQA\nfrom optuna.study import get_all_study_summaries  # NOQA\nfrom optuna.study import load_study  # NOQA\nfrom optuna.study import Study  # NOQA\nfrom optuna.trial import Trial  # NOQA\nfrom optuna.version import __version__  # NOQA\n", "path": "optuna/__init__.py"}]}