We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
web._generate_url returns ValueError--> intentional?
```
            return ValueError('Input not understood')
```
seems like it should be `raise` instead of `return`.  Am I missing something?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `statsmodels/tools/web.py`
Content:
```
1 """
2 Provides a function to open the system browser to either search or go directly
3 to a function's reference
4 """
5 import webbrowser
6 
7 from statsmodels.compat.python import urlencode
8 from statsmodels import __version__
9 
10 BASE_URL = 'https://www.statsmodels.org/'
11 
12 
13 def _generate_url(arg, stable):
14     """
15     Parse inputs and return a correctly formatted URL or an error if the input
16     is not understandable
17     """
18     url = BASE_URL
19     if stable:
20         url += 'stable/'
21     else:
22         url += 'devel/'
23 
24     if arg is None:
25         return url
26     elif type(arg) is str:
27         url += 'search.html?'
28         url += urlencode({'q': arg})
29         url += '&check_keywords=yes&area=default'
30     else:
31         try:
32             func = arg
33             func_name = func.__name__
34             func_module = func.__module__
35             if not func_module.startswith('statsmodels.'):
36                 return ValueError('Function must be from statsmodels')
37             url += 'generated/'
38             url += func_module + '.' + func_name + '.html'
39         except:
40             return ValueError('Input not understood')
41     return url
42 
43 
44 def webdoc(arg=None, stable=None):
45     """
46     Opens a browser and displays online documentation
47 
48     Parameters
49     ----------
50     arg, optional : string or statsmodels function
51         Either a string to search the documentation or a function
52     stable, optional : bool
53         Flag indicating whether to use the stable documentation (True) or
54         the development documentation (False).  If not provided, opens
55         the stable documentation if the current version of statsmodels is a
56         release
57 
58     Examples
59     --------
60     >>> import statsmodels.api as sm
61     >>> sm.webdoc()  # Documention site
62     >>> sm.webdoc('glm')  # Search for glm in docs
63     >>> sm.webdoc(sm.OLS, stable=False)  # Go to generated help for OLS, devel
64 
65     Notes
66     -----
67     By default, open stable documentation if the current version of statsmodels
68     is a release.  Otherwise opens the development documentation.
69 
70     Uses the default system browser.
71     """
72     stable = __version__ if 'dev' not in __version__ else stable
73     url_or_error = _generate_url(arg, stable)
74     if isinstance(url_or_error, ValueError):
75         raise url_or_error
76     webbrowser.open(url_or_error)
77     return None
78
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/statsmodels/tools/web.py b/statsmodels/tools/web.py
--- a/statsmodels/tools/web.py
+++ b/statsmodels/tools/web.py
@@ -4,7 +4,7 @@
 """
 import webbrowser
 
-from statsmodels.compat.python import urlencode
+from statsmodels.compat.python import urlencode, string_types
 from statsmodels import __version__
 
 BASE_URL = 'https://www.statsmodels.org/'
@@ -12,8 +12,8 @@
 
 def _generate_url(arg, stable):
     """
-    Parse inputs and return a correctly formatted URL or an error if the input
-    is not understandable
+    Parse inputs and return a correctly formatted URL or raises ValueError
+    if the input is not understandable
     """
     url = BASE_URL
     if stable:
@@ -23,7 +23,7 @@
 
     if arg is None:
         return url
-    elif type(arg) is str:
+    elif isinstance(arg, string_types):
         url += 'search.html?'
         url += urlencode({'q': arg})
         url += '&check_keywords=yes&area=default'
@@ -33,11 +33,11 @@
             func_name = func.__name__
             func_module = func.__module__
             if not func_module.startswith('statsmodels.'):
-                return ValueError('Function must be from statsmodels')
+                raise ValueError('Function must be from statsmodels')
             url += 'generated/'
             url += func_module + '.' + func_name + '.html'
-        except:
-            return ValueError('Input not understood')
+        except AttributeError:
+            raise ValueError('Input not understood')
     return url
 
 
@@ -71,7 +71,5 @@
     """
     stable = __version__ if 'dev' not in __version__ else stable
     url_or_error = _generate_url(arg, stable)
-    if isinstance(url_or_error, ValueError):
-        raise url_or_error
     webbrowser.open(url_or_error)
     return None

{"golden_diff": "diff --git a/statsmodels/tools/web.py b/statsmodels/tools/web.py\n--- a/statsmodels/tools/web.py\n+++ b/statsmodels/tools/web.py\n@@ -4,7 +4,7 @@\n \"\"\"\n import webbrowser\n \n-from statsmodels.compat.python import urlencode\n+from statsmodels.compat.python import urlencode, string_types\n from statsmodels import __version__\n \n BASE_URL = 'https://www.statsmodels.org/'\n@@ -12,8 +12,8 @@\n \n def _generate_url(arg, stable):\n     \"\"\"\n-    Parse inputs and return a correctly formatted URL or an error if the input\n-    is not understandable\n+    Parse inputs and return a correctly formatted URL or raises ValueError\n+    if the input is not understandable\n     \"\"\"\n     url = BASE_URL\n     if stable:\n@@ -23,7 +23,7 @@\n \n     if arg is None:\n         return url\n-    elif type(arg) is str:\n+    elif isinstance(arg, string_types):\n         url += 'search.html?'\n         url += urlencode({'q': arg})\n         url += '&check_keywords=yes&area=default'\n@@ -33,11 +33,11 @@\n             func_name = func.__name__\n             func_module = func.__module__\n             if not func_module.startswith('statsmodels.'):\n-                return ValueError('Function must be from statsmodels')\n+                raise ValueError('Function must be from statsmodels')\n             url += 'generated/'\n             url += func_module + '.' + func_name + '.html'\n-        except:\n-            return ValueError('Input not understood')\n+        except AttributeError:\n+            raise ValueError('Input not understood')\n     return url\n \n \n@@ -71,7 +71,5 @@\n     \"\"\"\n     stable = __version__ if 'dev' not in __version__ else stable\n     url_or_error = _generate_url(arg, stable)\n-    if isinstance(url_or_error, ValueError):\n-        raise url_or_error\n     webbrowser.open(url_or_error)\n     return None\n", "issue": "web._generate_url returns ValueError--> intentional?\n```\r\n            return ValueError('Input not understood')\r\n```\r\nseems like it should be `raise` instead of `return`.  Am I missing something?\n", "before_files": [{"content": "\"\"\"\nProvides a function to open the system browser to either search or go directly\nto a function's reference\n\"\"\"\nimport webbrowser\n\nfrom statsmodels.compat.python import urlencode\nfrom statsmodels import __version__\n\nBASE_URL = 'https://www.statsmodels.org/'\n\n\ndef _generate_url(arg, stable):\n    \"\"\"\n    Parse inputs and return a correctly formatted URL or an error if the input\n    is not understandable\n    \"\"\"\n    url = BASE_URL\n    if stable:\n        url += 'stable/'\n    else:\n        url += 'devel/'\n\n    if arg is None:\n        return url\n    elif type(arg) is str:\n        url += 'search.html?'\n        url += urlencode({'q': arg})\n        url += '&check_keywords=yes&area=default'\n    else:\n        try:\n            func = arg\n            func_name = func.__name__\n            func_module = func.__module__\n            if not func_module.startswith('statsmodels.'):\n                return ValueError('Function must be from statsmodels')\n            url += 'generated/'\n            url += func_module + '.' + func_name + '.html'\n        except:\n            return ValueError('Input not understood')\n    return url\n\n\ndef webdoc(arg=None, stable=None):\n    \"\"\"\n    Opens a browser and displays online documentation\n\n    Parameters\n    ----------\n    arg, optional : string or statsmodels function\n        Either a string to search the documentation or a function\n    stable, optional : bool\n        Flag indicating whether to use the stable documentation (True) or\n        the development documentation (False).  If not provided, opens\n        the stable documentation if the current version of statsmodels is a\n        release\n\n    Examples\n    --------\n    >>> import statsmodels.api as sm\n    >>> sm.webdoc()  # Documention site\n    >>> sm.webdoc('glm')  # Search for glm in docs\n    >>> sm.webdoc(sm.OLS, stable=False)  # Go to generated help for OLS, devel\n\n    Notes\n    -----\n    By default, open stable documentation if the current version of statsmodels\n    is a release.  Otherwise opens the development documentation.\n\n    Uses the default system browser.\n    \"\"\"\n    stable = __version__ if 'dev' not in __version__ else stable\n    url_or_error = _generate_url(arg, stable)\n    if isinstance(url_or_error, ValueError):\n        raise url_or_error\n    webbrowser.open(url_or_error)\n    return None\n", "path": "statsmodels/tools/web.py"}], "after_files": [{"content": "\"\"\"\nProvides a function to open the system browser to either search or go directly\nto a function's reference\n\"\"\"\nimport webbrowser\n\nfrom statsmodels.compat.python import urlencode, string_types\nfrom statsmodels import __version__\n\nBASE_URL = 'https://www.statsmodels.org/'\n\n\ndef _generate_url(arg, stable):\n    \"\"\"\n    Parse inputs and return a correctly formatted URL or raises ValueError\n    if the input is not understandable\n    \"\"\"\n    url = BASE_URL\n    if stable:\n        url += 'stable/'\n    else:\n        url += 'devel/'\n\n    if arg is None:\n        return url\n    elif isinstance(arg, string_types):\n        url += 'search.html?'\n        url += urlencode({'q': arg})\n        url += '&check_keywords=yes&area=default'\n    else:\n        try:\n            func = arg\n            func_name = func.__name__\n            func_module = func.__module__\n            if not func_module.startswith('statsmodels.'):\n                raise ValueError('Function must be from statsmodels')\n            url += 'generated/'\n            url += func_module + '.' + func_name + '.html'\n        except AttributeError:\n            raise ValueError('Input not understood')\n    return url\n\n\ndef webdoc(arg=None, stable=None):\n    \"\"\"\n    Opens a browser and displays online documentation\n\n    Parameters\n    ----------\n    arg, optional : string or statsmodels function\n        Either a string to search the documentation or a function\n    stable, optional : bool\n        Flag indicating whether to use the stable documentation (True) or\n        the development documentation (False).  If not provided, opens\n        the stable documentation if the current version of statsmodels is a\n        release\n\n    Examples\n    --------\n    >>> import statsmodels.api as sm\n    >>> sm.webdoc()  # Documention site\n    >>> sm.webdoc('glm')  # Search for glm in docs\n    >>> sm.webdoc(sm.OLS, stable=False)  # Go to generated help for OLS, devel\n\n    Notes\n    -----\n    By default, open stable documentation if the current version of statsmodels\n    is a release.  Otherwise opens the development documentation.\n\n    Uses the default system browser.\n    \"\"\"\n    stable = __version__ if 'dev' not in __version__ else stable\n    url_or_error = _generate_url(arg, stable)\n    webbrowser.open(url_or_error)\n    return None\n", "path": "statsmodels/tools/web.py"}]}