prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  With newer versions of orjson, users need to specify the json engine explicitly (bug?)
  Hey
  
  I found out I get an
  `AttributeError: partially initialized module 'orjson' has no attribute 'OPT_NON_STR_KEYS'`
  if I don't specify this
  `plotly.io.json.config.default_engine = 'orjson'`
  when using orjson v3.6.6 (latest as of 25jan2022)
  
  Also, additional note for whoever might have this issue: you don't need to uninstall orjson if you don't want to use it. just set the engine to 'json' explicitly. 
  
  I'm using orjson because of the performance claims, although I ran some tests switching between the 2 engines and they seem to yield the same results: using go.Candlestick with 10000 candlesticks and some 4-5 indicators, getting ~0.8sec in each case for creating the plot. My purpose is to improve the dash server performace, but it seems it makes no difference (the web page still renders slower than the ticker even with 600 candles)
  
  
  
  
  </issue>
  <code>
  [start of packages/python/plotly/_plotly_utils/optional_imports.py]
  1 """
  2 Stand-alone module to provide information about whether optional deps exist.
  3 
  4 """
  5 from importlib import import_module
  6 import logging
  7 import sys
  8 
  9 logger = logging.getLogger(__name__)
  10 _not_importable = set()
  11 
  12 
  13 def get_module(name, should_load=True):
  14     """
  15     Return module or None. Absolute import is required.
  16 
  17     :param (str) name: Dot-separated module path. E.g., 'scipy.stats'.
  18     :raise: (ImportError) Only when exc_msg is defined.
  19     :return: (module|None) If import succeeds, the module will be returned.
  20 
  21     """
  22     if name in sys.modules:
  23         return sys.modules[name]
  24     if not should_load:
  25         return None
  26     if name not in _not_importable:
  27         try:
  28             return import_module(name)
  29         except ImportError:
  30             _not_importable.add(name)
  31         except Exception:
  32             _not_importable.add(name)
  33             msg = f"Error importing optional module {name}"
  34             logger.exception(msg)
  35
  [end of packages/python/plotly/_plotly_utils/optional_imports.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/packages/python/plotly/_plotly_utils/optional_imports.py b/packages/python/plotly/_plotly_utils/optional_imports.py
  --- a/packages/python/plotly/_plotly_utils/optional_imports.py
  +++ b/packages/python/plotly/_plotly_utils/optional_imports.py
  @@ -2,6 +2,7 @@
   Stand-alone module to provide information about whether optional deps exist.
   
   """
  +
   from importlib import import_module
   import logging
   import sys
  @@ -19,10 +20,9 @@
       :return: (module|None) If import succeeds, the module will be returned.
   
       """
  -    if name in sys.modules:
  -        return sys.modules[name]
       if not should_load:
  -        return None
  +        return sys.modules.get(name, None)
  +
       if name not in _not_importable:
           try:
               return import_module(name)
  @@ -32,3 +32,5 @@
               _not_importable.add(name)
               msg = f"Error importing optional module {name}"
               logger.exception(msg)
  +
  +    return None
  
verification_info: {"golden_diff": "diff --git a/packages/python/plotly/_plotly_utils/optional_imports.py b/packages/python/plotly/_plotly_utils/optional_imports.py\n--- a/packages/python/plotly/_plotly_utils/optional_imports.py\n+++ b/packages/python/plotly/_plotly_utils/optional_imports.py\n@@ -2,6 +2,7 @@\n Stand-alone module to provide information about whether optional deps exist.\n \n \"\"\"\n+\n from importlib import import_module\n import logging\n import sys\n@@ -19,10 +20,9 @@\n     :return: (module|None) If import succeeds, the module will be returned.\n \n     \"\"\"\n-    if name in sys.modules:\n-        return sys.modules[name]\n     if not should_load:\n-        return None\n+        return sys.modules.get(name, None)\n+\n     if name not in _not_importable:\n         try:\n             return import_module(name)\n@@ -32,3 +32,5 @@\n             _not_importable.add(name)\n             msg = f\"Error importing optional module {name}\"\n             logger.exception(msg)\n+\n+    return None\n", "issue": "With newer versions of orjson, users need to specify the json engine explicitly (bug?)\nHey\r\n\r\nI found out I get an\r\n`AttributeError: partially initialized module 'orjson' has no attribute 'OPT_NON_STR_KEYS'`\r\nif I don't specify this\r\n`plotly.io.json.config.default_engine = 'orjson'`\r\nwhen using orjson v3.6.6 (latest as of 25jan2022)\r\n\r\nAlso, additional note for whoever might have this issue: you don't need to uninstall orjson if you don't want to use it. just set the engine to 'json' explicitly. \r\n\r\nI'm using orjson because of the performance claims, although I ran some tests switching between the 2 engines and they seem to yield the same results: using go.Candlestick with 10000 candlesticks and some 4-5 indicators, getting ~0.8sec in each case for creating the plot. My purpose is to improve the dash server performace, but it seems it makes no difference (the web page still renders slower than the ticker even with 600 candles)\r\n\r\n\r\n\n", "before_files": [{"content": "\"\"\"\nStand-alone module to provide information about whether optional deps exist.\n\n\"\"\"\nfrom importlib import import_module\nimport logging\nimport sys\n\nlogger = logging.getLogger(__name__)\n_not_importable = set()\n\n\ndef get_module(name, should_load=True):\n    \"\"\"\n    Return module or None. Absolute import is required.\n\n    :param (str) name: Dot-separated module path. E.g., 'scipy.stats'.\n    :raise: (ImportError) Only when exc_msg is defined.\n    :return: (module|None) If import succeeds, the module will be returned.\n\n    \"\"\"\n    if name in sys.modules:\n        return sys.modules[name]\n    if not should_load:\n        return None\n    if name not in _not_importable:\n        try:\n            return import_module(name)\n        except ImportError:\n            _not_importable.add(name)\n        except Exception:\n            _not_importable.add(name)\n            msg = f\"Error importing optional module {name}\"\n            logger.exception(msg)\n", "path": "packages/python/plotly/_plotly_utils/optional_imports.py"}]}