prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  BUG: Geostationary example bug
  ```
  python cartopy/docs/source/examples/geostationary.py
  Traceback (most recent call last):
    File "/net/home/h05/cpelley/git/cartopy/docs/source/examples/geostationary.py", line 60, in <module>
      main()
    File "/net/home/h05/cpelley/git/cartopy/docs/source/examples/geostationary.py", line 54, in main
      img, crs, extent, origin = geos_image()
    File "/net/home/h05/cpelley/git/cartopy/docs/source/examples/geostationary.py", line 43, in geos_image
      img_handle = BytesIO(urllib2.urlopen(url).read())
  NameError: global name 'urllib2' is not defined
  ```
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `lib/cartopy/examples/geostationary.py`
  Content:
  ```
  1 """
  2 Reprojecting images from a Geostationary projection
  3 ---------------------------------------------------
  4 
  5 This example demonstrates Cartopy's ability to project images into the desired
  6 projection on-the-fly. The image itself is retrieved from a URL and is loaded
  7 directly into memory without storing it intermediately into a file. It
  8 represents pre-processed data from Moderate-Resolution Imaging
  9 Spectroradiometer (MODIS) which has been put into an image in the data's
  10 native Geostationary coordinate system - it is then projected by cartopy
  11 into a global Miller map.
  12 
  13 """
  14 __tags__ = ["Scalar data"]
  15 try:
  16     from urllib2 import urlopen
  17 except ImportError:
  18     from urllib.request import urlopen
  19 from io import BytesIO
  20 
  21 import cartopy.crs as ccrs
  22 import matplotlib.pyplot as plt
  23 
  24 
  25 def geos_image():
  26     """
  27     Return a specific MODIS image by retrieving it from a github gist URL.
  28 
  29     Returns
  30     -------
  31     img : numpy array
  32         The pixels of the image in a numpy array.
  33     img_proj : cartopy CRS
  34         The rectangular coordinate system of the image.
  35     img_extent : tuple of floats
  36         The extent of the image ``(x0, y0, x1, y1)`` referenced in
  37         the ``img_proj`` coordinate system.
  38     origin : str
  39         The origin of the image to be passed through to matplotlib's imshow.
  40 
  41     """
  42     url = ('https://gist.github.com/pelson/5871263/raw/'
  43            'EIDA50_201211061300_clip2.png')
  44     img_handle = BytesIO(urllib2.urlopen(url).read())
  45     img = plt.imread(img_handle)
  46     img_proj = ccrs.Geostationary(satellite_height=35786000)
  47     img_extent = (-5500000, 5500000, -5500000, 5500000)
  48     return img, img_proj, img_extent, 'upper'
  49 
  50 
  51 def main():
  52     ax = plt.axes(projection=ccrs.Miller())
  53     ax.coastlines()
  54     ax.set_global()
  55     img, crs, extent, origin = geos_image()
  56     plt.imshow(img, transform=crs, extent=extent, origin=origin, cmap='gray')
  57     plt.show()
  58 
  59 
  60 if __name__ == '__main__':
  61     main()
  62
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/lib/cartopy/examples/geostationary.py b/lib/cartopy/examples/geostationary.py
  --- a/lib/cartopy/examples/geostationary.py
  +++ b/lib/cartopy/examples/geostationary.py
  @@ -41,7 +41,7 @@
       """
       url = ('https://gist.github.com/pelson/5871263/raw/'
              'EIDA50_201211061300_clip2.png')
  -    img_handle = BytesIO(urllib2.urlopen(url).read())
  +    img_handle = BytesIO(urlopen(url).read())
       img = plt.imread(img_handle)
       img_proj = ccrs.Geostationary(satellite_height=35786000)
       img_extent = (-5500000, 5500000, -5500000, 5500000)
  
verification_info: {"golden_diff": "diff --git a/lib/cartopy/examples/geostationary.py b/lib/cartopy/examples/geostationary.py\n--- a/lib/cartopy/examples/geostationary.py\n+++ b/lib/cartopy/examples/geostationary.py\n@@ -41,7 +41,7 @@\n     \"\"\"\n     url = ('https://gist.github.com/pelson/5871263/raw/'\n            'EIDA50_201211061300_clip2.png')\n-    img_handle = BytesIO(urllib2.urlopen(url).read())\n+    img_handle = BytesIO(urlopen(url).read())\n     img = plt.imread(img_handle)\n     img_proj = ccrs.Geostationary(satellite_height=35786000)\n     img_extent = (-5500000, 5500000, -5500000, 5500000)\n", "issue": "BUG: Geostationary example bug\n```\npython cartopy/docs/source/examples/geostationary.py\nTraceback (most recent call last):\n  File \"/net/home/h05/cpelley/git/cartopy/docs/source/examples/geostationary.py\", line 60, in <module>\n    main()\n  File \"/net/home/h05/cpelley/git/cartopy/docs/source/examples/geostationary.py\", line 54, in main\n    img, crs, extent, origin = geos_image()\n  File \"/net/home/h05/cpelley/git/cartopy/docs/source/examples/geostationary.py\", line 43, in geos_image\n    img_handle = BytesIO(urllib2.urlopen(url).read())\nNameError: global name 'urllib2' is not defined\n```\n\n", "before_files": [{"content": "\"\"\"\nReprojecting images from a Geostationary projection\n---------------------------------------------------\n\nThis example demonstrates Cartopy's ability to project images into the desired\nprojection on-the-fly. The image itself is retrieved from a URL and is loaded\ndirectly into memory without storing it intermediately into a file. It\nrepresents pre-processed data from Moderate-Resolution Imaging\nSpectroradiometer (MODIS) which has been put into an image in the data's\nnative Geostationary coordinate system - it is then projected by cartopy\ninto a global Miller map.\n\n\"\"\"\n__tags__ = [\"Scalar data\"]\ntry:\n    from urllib2 import urlopen\nexcept ImportError:\n    from urllib.request import urlopen\nfrom io import BytesIO\n\nimport cartopy.crs as ccrs\nimport matplotlib.pyplot as plt\n\n\ndef geos_image():\n    \"\"\"\n    Return a specific MODIS image by retrieving it from a github gist URL.\n\n    Returns\n    -------\n    img : numpy array\n        The pixels of the image in a numpy array.\n    img_proj : cartopy CRS\n        The rectangular coordinate system of the image.\n    img_extent : tuple of floats\n        The extent of the image ``(x0, y0, x1, y1)`` referenced in\n        the ``img_proj`` coordinate system.\n    origin : str\n        The origin of the image to be passed through to matplotlib's imshow.\n\n    \"\"\"\n    url = ('https://gist.github.com/pelson/5871263/raw/'\n           'EIDA50_201211061300_clip2.png')\n    img_handle = BytesIO(urllib2.urlopen(url).read())\n    img = plt.imread(img_handle)\n    img_proj = ccrs.Geostationary(satellite_height=35786000)\n    img_extent = (-5500000, 5500000, -5500000, 5500000)\n    return img, img_proj, img_extent, 'upper'\n\n\ndef main():\n    ax = plt.axes(projection=ccrs.Miller())\n    ax.coastlines()\n    ax.set_global()\n    img, crs, extent, origin = geos_image()\n    plt.imshow(img, transform=crs, extent=extent, origin=origin, cmap='gray')\n    plt.show()\n\n\nif __name__ == '__main__':\n    main()\n", "path": "lib/cartopy/examples/geostationary.py"}], "after_files": [{"content": "\"\"\"\nReprojecting images from a Geostationary projection\n---------------------------------------------------\n\nThis example demonstrates Cartopy's ability to project images into the desired\nprojection on-the-fly. The image itself is retrieved from a URL and is loaded\ndirectly into memory without storing it intermediately into a file. It\nrepresents pre-processed data from Moderate-Resolution Imaging\nSpectroradiometer (MODIS) which has been put into an image in the data's\nnative Geostationary coordinate system - it is then projected by cartopy\ninto a global Miller map.\n\n\"\"\"\n__tags__ = [\"Scalar data\"]\ntry:\n    from urllib2 import urlopen\nexcept ImportError:\n    from urllib.request import urlopen\nfrom io import BytesIO\n\nimport cartopy.crs as ccrs\nimport matplotlib.pyplot as plt\n\n\ndef geos_image():\n    \"\"\"\n    Return a specific MODIS image by retrieving it from a github gist URL.\n\n    Returns\n    -------\n    img : numpy array\n        The pixels of the image in a numpy array.\n    img_proj : cartopy CRS\n        The rectangular coordinate system of the image.\n    img_extent : tuple of floats\n        The extent of the image ``(x0, y0, x1, y1)`` referenced in\n        the ``img_proj`` coordinate system.\n    origin : str\n        The origin of the image to be passed through to matplotlib's imshow.\n\n    \"\"\"\n    url = ('https://gist.github.com/pelson/5871263/raw/'\n           'EIDA50_201211061300_clip2.png')\n    img_handle = BytesIO(urlopen(url).read())\n    img = plt.imread(img_handle)\n    img_proj = ccrs.Geostationary(satellite_height=35786000)\n    img_extent = (-5500000, 5500000, -5500000, 5500000)\n    return img, img_proj, img_extent, 'upper'\n\n\ndef main():\n    ax = plt.axes(projection=ccrs.Miller())\n    ax.coastlines()\n    ax.set_global()\n    img, crs, extent, origin = geos_image()\n    plt.imshow(img, transform=crs, extent=extent, origin=origin, cmap='gray')\n    plt.show()\n\n\nif __name__ == '__main__':\n    main()\n", "path": "lib/cartopy/examples/geostationary.py"}]}