We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
MISO <-> Canada interconnector
..needs to be updated as it still pointing to Montana instead of MISO
![image](https://user-images.githubusercontent.com/1655848/35481513-36ff7488-0425-11e8-91f4-b487c037240a.png)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `parsers/CA_ON.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 # The arrow library is used to handle datetimes
4 import arrow
5 # The request library is used to fetch content through HTTP
6 import requests
7 
8 from bs4 import BeautifulSoup
9 
10 MAP_GENERATION = {
11     'BIOFUEL': 'biomass',
12     'GAS': 'gas',
13     'HYDRO': 'hydro',
14     'NUCLEAR': 'nuclear',
15     'SOLAR': 'solar',
16     'WIND': 'wind'
17 }
18 
19 timezone = 'Canada/Eastern'
20 
21 
22 def fetch_production(country_code='CA-ON', session=None):
23     """Requests the last known production mix (in MW) of a given country
24 
25     Arguments:
26     country_code (optional) -- used in case a parser is able to fetch multiple countries
27     session (optional)      -- request session passed in order to re-use an existing session
28 
29     Return:
30     A dictionary in the form:
31     {
32       'countryCode': 'FR',
33       'datetime': '2017-01-01T00:00:00Z',
34       'production': {
35           'biomass': 0.0,
36           'coal': 0.0,
37           'gas': 0.0,
38           'hydro': 0.0,
39           'nuclear': null,
40           'oil': 0.0,
41           'solar': 0.0,
42           'wind': 0.0,
43           'geothermal': 0.0,
44           'unknown': 0.0
45       },
46       'storage': {
47           'hydro': -10.0,
48       },
49       'source': 'mysource.com'
50     }
51     """
52     r = session or requests.session()
53     url = 'http://www.ieso.ca/-/media/files/ieso/uploaded/chart/generation_fuel_type_multiday.xml?la=en'
54     response = r.get(url)
55     soup = BeautifulSoup(response.text, 'html.parser')
56 
57     data = {}
58 
59     start_datetime = arrow.get(
60         arrow.get(soup.find_all('startdate')[0].contents[0]).datetime, timezone)
61 
62     # Iterate over all datasets (production types)
63     for item in soup.find_all('dataset'):
64         key = item.attrs['series']
65         for rowIndex, row in enumerate(item.find_all('value')):
66             if not len(row.contents):
67                 continue
68             if rowIndex not in data:
69                 data[rowIndex] = {
70                     'datetime': start_datetime.replace(hours=+rowIndex).datetime,
71                     'countryCode': country_code,
72                     'production': {
73                         'coal': 0
74                     },
75                     'storage': {},
76                     'source': 'ieso.ca',
77                 }
78             data[rowIndex]['production'][MAP_GENERATION[key]] = \
79                 float(row.contents[0])
80 
81     return [data[k] for k in sorted(data.keys())]
82 
83 
84 def fetch_price(country_code='CA-ON', session=None):
85     """Requests the last known power price of a given country
86 
87     Arguments:
88     country_code (optional) -- used in case a parser is able to fetch multiple countries
89     session (optional)      -- request session passed in order to re-use an existing session
90 
91     Return:
92     A dictionary in the form:
93     {
94       'countryCode': 'FR',
95       'currency': EUR,
96       'datetime': '2017-01-01T00:00:00Z',
97       'price': 0.0,
98       'source': 'mysource.com'
99     }
100     """
101 
102     r = session or requests.session()
103     url = 'http://www.ieso.ca/-/media/files/ieso/uploaded/chart/price_multiday.xml?la=en'
104     response = r.get(url)
105     soup = BeautifulSoup(response.text, 'html.parser')
106 
107     data = {}
108 
109     start_datetime = arrow.get(
110         arrow.get(soup.find_all('startdate')[0].contents[0]).datetime, timezone)
111 
112     # Iterate over all datasets (production types)
113     for item in soup.find_all('dataset'):
114         key = item.attrs['series']
115         if key != 'HOEP':
116             continue
117         for rowIndex, row in enumerate(item.find_all('value')):
118             if not len(row.contents):
119                 continue
120             if rowIndex not in data:
121                 data[rowIndex] = {
122                     'datetime': start_datetime.replace(hours=+rowIndex).datetime,
123                     'countryCode': country_code,
124                     'currency': 'CAD',
125                     'source': 'ieso.ca',
126                 }
127             data[rowIndex]['price'] = \
128                 float(row.contents[0])
129 
130     return [data[k] for k in sorted(data.keys())]
131 
132     return data
133 
134 
135 def fetch_exchange(country_code1, country_code2, session=None):
136     """Requests the last known power exchange (in MW) between two countries
137 
138     Arguments:
139     country_code (optional) -- used in case a parser is able to fetch multiple countries
140     session (optional)      -- request session passed in order to re-use an existing session
141 
142     Return:
143     A dictionary in the form:
144     {
145       'sortedCountryCodes': 'DK->NO',
146       'datetime': '2017-01-01T00:00:00Z',
147       'netFlow': 0.0,
148       'source': 'mysource.com'
149     }
150     """
151 
152     r = session or requests.session()
153     url = 'http://live.gridwatch.ca/WebServices/GridWatchWebApp.asmx/GetHomeViewData_v2'
154     response = r.get(url)
155     obj = response.json()
156     exchanges = obj['intertieLineData']
157 
158     sortedCountryCodes = '->'.join(sorted([country_code1, country_code2]))
159     # Everything -> CA_ON corresponds to an import to ON
160     # In the data, "net" represents an export
161     # So everything -> CA_ON must be reversed
162     if sortedCountryCodes == 'CA-MB->CA-ON':
163         keys = ['MANITOBA', 'MANITOBA SK']
164         direction = -1
165     elif sortedCountryCodes == 'CA-ON->US-NY':
166         keys = ['NEW-YORK']
167         direction = 1
168     elif sortedCountryCodes == 'CA-ON->US-MI':
169         keys = ['MICHIGAN']
170         direction = 1
171     elif sortedCountryCodes == 'CA-ON->US-MN':
172         keys = ['MINNESOTA']
173         direction = 1
174     elif sortedCountryCodes == 'CA-ON->CA-QC':
175         keys = filter(lambda k: k[:2] == 'PQ', exchanges.keys())
176         direction = 1
177     else:
178         raise NotImplementedError('This exchange pair is not implemented')
179 
180     data = {
181         'datetime': max(map(lambda x: arrow.get(arrow.get(
182             exchanges[x]['dateReported']).datetime, timezone).datetime, keys)),
183         'sortedCountryCodes': sortedCountryCodes,
184         'netFlow': sum(map(lambda x: float(exchanges[x]['net'].replace(',', '')), keys)) * direction,
185         'source': 'gridwatch.ca'
186     }
187 
188     return data
189 
190 
191 if __name__ == '__main__':
192     """Main method, never used by the Electricity Map backend, but handy for testing."""
193 
194     print('fetch_production() ->')
195     print(fetch_production())
196     print('fetch_price() ->')
197     print(fetch_price())
198     print('fetch_exchange("CA-ON", "US-NY") ->')
199     print(fetch_exchange("CA-ON", "US-NY"))
200
```
--- 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/parsers/CA_ON.py b/parsers/CA_ON.py
--- a/parsers/CA_ON.py
+++ b/parsers/CA_ON.py
@@ -165,11 +165,8 @@
     elif sortedCountryCodes == 'CA-ON->US-NY':
         keys = ['NEW-YORK']
         direction = 1
-    elif sortedCountryCodes == 'CA-ON->US-MI':
-        keys = ['MICHIGAN']
-        direction = 1
-    elif sortedCountryCodes == 'CA-ON->US-MN':
-        keys = ['MINNESOTA']
+    elif sortedCountryCodes == 'CA-ON->US-MISO':
+        keys = ['MICHIGAN', 'MINNESOTA']
         direction = 1
     elif sortedCountryCodes == 'CA-ON->CA-QC':
         keys = filter(lambda k: k[:2] == 'PQ', exchanges.keys())

{"golden_diff": "diff --git a/parsers/CA_ON.py b/parsers/CA_ON.py\n--- a/parsers/CA_ON.py\n+++ b/parsers/CA_ON.py\n@@ -165,11 +165,8 @@\n     elif sortedCountryCodes == 'CA-ON->US-NY':\n         keys = ['NEW-YORK']\n         direction = 1\n-    elif sortedCountryCodes == 'CA-ON->US-MI':\n-        keys = ['MICHIGAN']\n-        direction = 1\n-    elif sortedCountryCodes == 'CA-ON->US-MN':\n-        keys = ['MINNESOTA']\n+    elif sortedCountryCodes == 'CA-ON->US-MISO':\n+        keys = ['MICHIGAN', 'MINNESOTA']\n         direction = 1\n     elif sortedCountryCodes == 'CA-ON->CA-QC':\n         keys = filter(lambda k: k[:2] == 'PQ', exchanges.keys())\n", "issue": "MISO <-> Canada interconnector\n..needs to be updated as it still pointing to Montana instead of MISO\r\n![image](https://user-images.githubusercontent.com/1655848/35481513-36ff7488-0425-11e8-91f4-b487c037240a.png)\r\n\n", "before_files": [{"content": "#!/usr/bin/env python3\n\n# The arrow library is used to handle datetimes\nimport arrow\n# The request library is used to fetch content through HTTP\nimport requests\n\nfrom bs4 import BeautifulSoup\n\nMAP_GENERATION = {\n    'BIOFUEL': 'biomass',\n    'GAS': 'gas',\n    'HYDRO': 'hydro',\n    'NUCLEAR': 'nuclear',\n    'SOLAR': 'solar',\n    'WIND': 'wind'\n}\n\ntimezone = 'Canada/Eastern'\n\n\ndef fetch_production(country_code='CA-ON', session=None):\n    \"\"\"Requests the last known production mix (in MW) of a given country\n\n    Arguments:\n    country_code (optional) -- used in case a parser is able to fetch multiple countries\n    session (optional)      -- request session passed in order to re-use an existing session\n\n    Return:\n    A dictionary in the form:\n    {\n      'countryCode': 'FR',\n      'datetime': '2017-01-01T00:00:00Z',\n      'production': {\n          'biomass': 0.0,\n          'coal': 0.0,\n          'gas': 0.0,\n          'hydro': 0.0,\n          'nuclear': null,\n          'oil': 0.0,\n          'solar': 0.0,\n          'wind': 0.0,\n          'geothermal': 0.0,\n          'unknown': 0.0\n      },\n      'storage': {\n          'hydro': -10.0,\n      },\n      'source': 'mysource.com'\n    }\n    \"\"\"\n    r = session or requests.session()\n    url = 'http://www.ieso.ca/-/media/files/ieso/uploaded/chart/generation_fuel_type_multiday.xml?la=en'\n    response = r.get(url)\n    soup = BeautifulSoup(response.text, 'html.parser')\n\n    data = {}\n\n    start_datetime = arrow.get(\n        arrow.get(soup.find_all('startdate')[0].contents[0]).datetime, timezone)\n\n    # Iterate over all datasets (production types)\n    for item in soup.find_all('dataset'):\n        key = item.attrs['series']\n        for rowIndex, row in enumerate(item.find_all('value')):\n            if not len(row.contents):\n                continue\n            if rowIndex not in data:\n                data[rowIndex] = {\n                    'datetime': start_datetime.replace(hours=+rowIndex).datetime,\n                    'countryCode': country_code,\n                    'production': {\n                        'coal': 0\n                    },\n                    'storage': {},\n                    'source': 'ieso.ca',\n                }\n            data[rowIndex]['production'][MAP_GENERATION[key]] = \\\n                float(row.contents[0])\n\n    return [data[k] for k in sorted(data.keys())]\n\n\ndef fetch_price(country_code='CA-ON', session=None):\n    \"\"\"Requests the last known power price of a given country\n\n    Arguments:\n    country_code (optional) -- used in case a parser is able to fetch multiple countries\n    session (optional)      -- request session passed in order to re-use an existing session\n\n    Return:\n    A dictionary in the form:\n    {\n      'countryCode': 'FR',\n      'currency': EUR,\n      'datetime': '2017-01-01T00:00:00Z',\n      'price': 0.0,\n      'source': 'mysource.com'\n    }\n    \"\"\"\n\n    r = session or requests.session()\n    url = 'http://www.ieso.ca/-/media/files/ieso/uploaded/chart/price_multiday.xml?la=en'\n    response = r.get(url)\n    soup = BeautifulSoup(response.text, 'html.parser')\n\n    data = {}\n\n    start_datetime = arrow.get(\n        arrow.get(soup.find_all('startdate')[0].contents[0]).datetime, timezone)\n\n    # Iterate over all datasets (production types)\n    for item in soup.find_all('dataset'):\n        key = item.attrs['series']\n        if key != 'HOEP':\n            continue\n        for rowIndex, row in enumerate(item.find_all('value')):\n            if not len(row.contents):\n                continue\n            if rowIndex not in data:\n                data[rowIndex] = {\n                    'datetime': start_datetime.replace(hours=+rowIndex).datetime,\n                    'countryCode': country_code,\n                    'currency': 'CAD',\n                    'source': 'ieso.ca',\n                }\n            data[rowIndex]['price'] = \\\n                float(row.contents[0])\n\n    return [data[k] for k in sorted(data.keys())]\n\n    return data\n\n\ndef fetch_exchange(country_code1, country_code2, session=None):\n    \"\"\"Requests the last known power exchange (in MW) between two countries\n\n    Arguments:\n    country_code (optional) -- used in case a parser is able to fetch multiple countries\n    session (optional)      -- request session passed in order to re-use an existing session\n\n    Return:\n    A dictionary in the form:\n    {\n      'sortedCountryCodes': 'DK->NO',\n      'datetime': '2017-01-01T00:00:00Z',\n      'netFlow': 0.0,\n      'source': 'mysource.com'\n    }\n    \"\"\"\n\n    r = session or requests.session()\n    url = 'http://live.gridwatch.ca/WebServices/GridWatchWebApp.asmx/GetHomeViewData_v2'\n    response = r.get(url)\n    obj = response.json()\n    exchanges = obj['intertieLineData']\n\n    sortedCountryCodes = '->'.join(sorted([country_code1, country_code2]))\n    # Everything -> CA_ON corresponds to an import to ON\n    # In the data, \"net\" represents an export\n    # So everything -> CA_ON must be reversed\n    if sortedCountryCodes == 'CA-MB->CA-ON':\n        keys = ['MANITOBA', 'MANITOBA SK']\n        direction = -1\n    elif sortedCountryCodes == 'CA-ON->US-NY':\n        keys = ['NEW-YORK']\n        direction = 1\n    elif sortedCountryCodes == 'CA-ON->US-MI':\n        keys = ['MICHIGAN']\n        direction = 1\n    elif sortedCountryCodes == 'CA-ON->US-MN':\n        keys = ['MINNESOTA']\n        direction = 1\n    elif sortedCountryCodes == 'CA-ON->CA-QC':\n        keys = filter(lambda k: k[:2] == 'PQ', exchanges.keys())\n        direction = 1\n    else:\n        raise NotImplementedError('This exchange pair is not implemented')\n\n    data = {\n        'datetime': max(map(lambda x: arrow.get(arrow.get(\n            exchanges[x]['dateReported']).datetime, timezone).datetime, keys)),\n        'sortedCountryCodes': sortedCountryCodes,\n        'netFlow': sum(map(lambda x: float(exchanges[x]['net'].replace(',', '')), keys)) * direction,\n        'source': 'gridwatch.ca'\n    }\n\n    return data\n\n\nif __name__ == '__main__':\n    \"\"\"Main method, never used by the Electricity Map backend, but handy for testing.\"\"\"\n\n    print('fetch_production() ->')\n    print(fetch_production())\n    print('fetch_price() ->')\n    print(fetch_price())\n    print('fetch_exchange(\"CA-ON\", \"US-NY\") ->')\n    print(fetch_exchange(\"CA-ON\", \"US-NY\"))\n", "path": "parsers/CA_ON.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\n# The arrow library is used to handle datetimes\nimport arrow\n# The request library is used to fetch content through HTTP\nimport requests\n\nfrom bs4 import BeautifulSoup\n\nMAP_GENERATION = {\n    'BIOFUEL': 'biomass',\n    'GAS': 'gas',\n    'HYDRO': 'hydro',\n    'NUCLEAR': 'nuclear',\n    'SOLAR': 'solar',\n    'WIND': 'wind'\n}\n\ntimezone = 'Canada/Eastern'\n\n\ndef fetch_production(country_code='CA-ON', session=None):\n    \"\"\"Requests the last known production mix (in MW) of a given country\n\n    Arguments:\n    country_code (optional) -- used in case a parser is able to fetch multiple countries\n    session (optional)      -- request session passed in order to re-use an existing session\n\n    Return:\n    A dictionary in the form:\n    {\n      'countryCode': 'FR',\n      'datetime': '2017-01-01T00:00:00Z',\n      'production': {\n          'biomass': 0.0,\n          'coal': 0.0,\n          'gas': 0.0,\n          'hydro': 0.0,\n          'nuclear': null,\n          'oil': 0.0,\n          'solar': 0.0,\n          'wind': 0.0,\n          'geothermal': 0.0,\n          'unknown': 0.0\n      },\n      'storage': {\n          'hydro': -10.0,\n      },\n      'source': 'mysource.com'\n    }\n    \"\"\"\n    r = session or requests.session()\n    url = 'http://www.ieso.ca/-/media/files/ieso/uploaded/chart/generation_fuel_type_multiday.xml?la=en'\n    response = r.get(url)\n    soup = BeautifulSoup(response.text, 'html.parser')\n\n    data = {}\n\n    start_datetime = arrow.get(\n        arrow.get(soup.find_all('startdate')[0].contents[0]).datetime, timezone)\n\n    # Iterate over all datasets (production types)\n    for item in soup.find_all('dataset'):\n        key = item.attrs['series']\n        for rowIndex, row in enumerate(item.find_all('value')):\n            if not len(row.contents):\n                continue\n            if rowIndex not in data:\n                data[rowIndex] = {\n                    'datetime': start_datetime.replace(hours=+rowIndex).datetime,\n                    'countryCode': country_code,\n                    'production': {\n                        'coal': 0\n                    },\n                    'storage': {},\n                    'source': 'ieso.ca',\n                }\n            data[rowIndex]['production'][MAP_GENERATION[key]] = \\\n                float(row.contents[0])\n\n    return [data[k] for k in sorted(data.keys())]\n\n\ndef fetch_price(country_code='CA-ON', session=None):\n    \"\"\"Requests the last known power price of a given country\n\n    Arguments:\n    country_code (optional) -- used in case a parser is able to fetch multiple countries\n    session (optional)      -- request session passed in order to re-use an existing session\n\n    Return:\n    A dictionary in the form:\n    {\n      'countryCode': 'FR',\n      'currency': EUR,\n      'datetime': '2017-01-01T00:00:00Z',\n      'price': 0.0,\n      'source': 'mysource.com'\n    }\n    \"\"\"\n\n    r = session or requests.session()\n    url = 'http://www.ieso.ca/-/media/files/ieso/uploaded/chart/price_multiday.xml?la=en'\n    response = r.get(url)\n    soup = BeautifulSoup(response.text, 'html.parser')\n\n    data = {}\n\n    start_datetime = arrow.get(\n        arrow.get(soup.find_all('startdate')[0].contents[0]).datetime, timezone)\n\n    # Iterate over all datasets (production types)\n    for item in soup.find_all('dataset'):\n        key = item.attrs['series']\n        if key != 'HOEP':\n            continue\n        for rowIndex, row in enumerate(item.find_all('value')):\n            if not len(row.contents):\n                continue\n            if rowIndex not in data:\n                data[rowIndex] = {\n                    'datetime': start_datetime.replace(hours=+rowIndex).datetime,\n                    'countryCode': country_code,\n                    'currency': 'CAD',\n                    'source': 'ieso.ca',\n                }\n            data[rowIndex]['price'] = \\\n                float(row.contents[0])\n\n    return [data[k] for k in sorted(data.keys())]\n\n    return data\n\n\ndef fetch_exchange(country_code1, country_code2, session=None):\n    \"\"\"Requests the last known power exchange (in MW) between two countries\n\n    Arguments:\n    country_code (optional) -- used in case a parser is able to fetch multiple countries\n    session (optional)      -- request session passed in order to re-use an existing session\n\n    Return:\n    A dictionary in the form:\n    {\n      'sortedCountryCodes': 'DK->NO',\n      'datetime': '2017-01-01T00:00:00Z',\n      'netFlow': 0.0,\n      'source': 'mysource.com'\n    }\n    \"\"\"\n\n    r = session or requests.session()\n    url = 'http://live.gridwatch.ca/WebServices/GridWatchWebApp.asmx/GetHomeViewData_v2'\n    response = r.get(url)\n    obj = response.json()\n    exchanges = obj['intertieLineData']\n\n    sortedCountryCodes = '->'.join(sorted([country_code1, country_code2]))\n    # Everything -> CA_ON corresponds to an import to ON\n    # In the data, \"net\" represents an export\n    # So everything -> CA_ON must be reversed\n    if sortedCountryCodes == 'CA-MB->CA-ON':\n        keys = ['MANITOBA', 'MANITOBA SK']\n        direction = -1\n    elif sortedCountryCodes == 'CA-ON->US-NY':\n        keys = ['NEW-YORK']\n        direction = 1\n    elif sortedCountryCodes == 'CA-ON->US-MISO':\n        keys = ['MICHIGAN', 'MINNESOTA']\n        direction = 1\n    elif sortedCountryCodes == 'CA-ON->CA-QC':\n        keys = filter(lambda k: k[:2] == 'PQ', exchanges.keys())\n        direction = 1\n    else:\n        raise NotImplementedError('This exchange pair is not implemented')\n\n    data = {\n        'datetime': max(map(lambda x: arrow.get(arrow.get(\n            exchanges[x]['dateReported']).datetime, timezone).datetime, keys)),\n        'sortedCountryCodes': sortedCountryCodes,\n        'netFlow': sum(map(lambda x: float(exchanges[x]['net'].replace(',', '')), keys)) * direction,\n        'source': 'gridwatch.ca'\n    }\n\n    return data\n\n\nif __name__ == '__main__':\n    \"\"\"Main method, never used by the Electricity Map backend, but handy for testing.\"\"\"\n\n    print('fetch_production() ->')\n    print(fetch_production())\n    print('fetch_price() ->')\n    print(fetch_price())\n    print('fetch_exchange(\"CA-ON\", \"US-NY\") ->')\n    print(fetch_exchange(\"CA-ON\", \"US-NY\"))\n", "path": "parsers/CA_ON.py"}]}