We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
The import/export between Menorca and Mallorca appears reversed
Our data is showing the export going one way, but our data source is showing the reverse according to one user. See screenshots:
![IMG_9768](https://user-images.githubusercontent.com/8129157/86447078-17d4b400-bd15-11ea-87da-15f44842d645.PNG)
![image](https://user-images.githubusercontent.com/8129157/86447080-186d4a80-bd15-11ea-8f22-9ab474bb070b.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/ES_IB.py`
Content:
```
1 #!/usr/bin/env python3
2 
3 import logging
4 from arrow import get
5 from requests import Session
6 from ree import (Formentera, Ibiza,
7                  Mallorca, Menorca,
8                  BalearicIslands)
9 # package "ree" is used to parse data from www.ree.es // maintained on github by @hectorespert
10 
11 from .lib.exceptions import ParserException
12 from .lib.validation import validate, validate_production_diffs
13 
14 ## Guess we'll need to figure these out later?! Adapted from ES-CN:
15 
16 # Minimum valid zone demand. This is used to eliminate some cases
17 # where generation for one or more modes is obviously missing.
18 FLOORS = {
19     'ES-IB': 0,
20     'ES-IB-FO': 0,
21     'ES-IB-IZ': 0,
22     'ES-IB-MA': 0,
23     'ES-IB-ME': 0,
24 }
25 
26 
27 def fetch_island_data(zone_key, session):
28     if zone_key == 'ES-IB-FO':
29         formentera_data = Formentera(session, verify=False).get_all()
30         if not formentera_data:
31             raise ParserException(zone_key, "Formentera doesn't respond")
32         else:
33             return formentera_data
34     elif zone_key == 'ES-IB-IZ':
35         ibiza_data = Ibiza(session, verify=False).get_all()
36         if not ibiza_data:
37             raise ParserException(zone_key, "Party is over, Ibiza doesn't respond")
38         else:
39             return ibiza_data
40     elif zone_key == 'ES-IB-MA':
41         mallorca_data = Mallorca(session, verify=False).get_all()
42         if not mallorca_data:
43             raise ParserException(zone_key, "Mallorca doesn't respond")
44         else:
45             return mallorca_data
46     elif zone_key == 'ES-IB-ME':
47         menorca_data = Menorca(session, verify=False).get_all()
48         if not menorca_data:
49             raise ParserException(zone_key, "Menorca doesn't respond")
50         else:
51             return menorca_data
52     elif zone_key == 'ES-IB':
53         balearic_islands = BalearicIslands(session, verify=False).get_all()
54         if not balearic_islands:
55             raise ParserException(zone_key, "Balearic Islands doesn't respond")
56         else:
57             return balearic_islands
58     else:
59         raise ParserException(zone_key, 'Can\'t read this country code {0}'.format(zone_key))
60 
61 
62 def fetch_consumption(zone_key, session=None, target_datetime=None, logger=None):
63     if target_datetime:
64         raise NotImplementedError('This parser is not yet able to parse past dates')
65 
66     ses = session or Session()
67     island_data = fetch_island_data(zone_key, ses)
68     data = []
69     for response in island_data:
70         response_data = {
71             'zoneKey': zone_key,
72             'datetime': get(response.timestamp).datetime,
73             'consumption': response.demand,
74             'source': 'demanda.ree.es'
75         }
76 
77         data.append(response_data)
78 
79     return data
80 
81 
82 def fetch_production(zone_key, session=None, target_datetime=None,
83                      logger=logging.getLogger(__name__)):
84     if target_datetime:
85         raise NotImplementedError('This parser is not yet able to parse past dates')
86 
87     ses = session or Session()
88     island_data = fetch_island_data(zone_key, ses)
89     data = []
90 
91     if zone_key == 'ES-IB':
92         expected_range = {'coal': (50,600)}
93     else:
94         expected_range = None
95 
96     for response in island_data:
97         if response.production() >= 0:
98             response_data = {
99                 'zoneKey': zone_key,
100                 'datetime': get(response.timestamp).datetime,
101                 'production': {
102                 'coal': response.carbon,
103                 'gas': round(response.gas + response.combined, 2),
104                 'solar': response.solar,
105                 'oil': round(response.vapor + response.diesel, 2),
106                 'wind': response.wind,
107                 'hydro': response.hydraulic,
108                 'biomass': response.waste,
109                 'nuclear': 0.0,
110                 'geothermal': 0.0,
111                 'unknown': response.other
112             },
113             'storage': {
114                 'hydro': 0.0,
115                 'battery': 0.0
116             },
117             'source': 'demanda.ree.es',
118         }
119 
120             response_data = validate(response_data, logger,
121                                             floor=FLOORS[zone_key],
122                                             expected_range = expected_range)
123 
124             if response_data:
125                 # append if valid
126                 data.append(response_data)
127 
128     if len(data) > 1:
129         # granularity is 10 minutes, drops points with change in coal > 100MW
130         data = validate_production_diffs(data, {'coal': 150}, logger)
131 
132     return data
133 
134 
135 def fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None):
136 
137     if target_datetime:
138         raise NotImplementedError('This parser is not yet able to parse past dates')
139 
140     sorted_zone_keys = '->'.join(sorted([zone_key1, zone_key2]))
141 
142     ses = session or Session()
143 
144     if sorted_zone_keys == 'ES->ES-IB':
145         responses = BalearicIslands(ses, verify=False).get_all()
146         if not responses:
147             raise ParserException("ES-IB", "No responses")
148     elif sorted_zone_keys == 'ES->ES-IB-MA' or sorted_zone_keys == 'ES-IB-MA->ES-IB-ME' or sorted_zone_keys == 'ES-IB-IZ->ES-IB-MA':
149         responses = Mallorca(ses, verify=False).get_all()
150         if not responses:
151             raise ParserException("ES-IB-MA", "No responses")
152     elif sorted_zone_keys == 'ES-IB-FO->ES-IB-IZ':
153         responses = Formentera(ses, verify=False).get_all()
154         if not responses:
155             raise ParserException("ES-IB-FO", "No responses")
156     else:
157         raise NotImplementedError('This exchange pair is not implemented')
158 
159     exchanges = []
160     for response in responses:
161 
162         if sorted_zone_keys == 'ES-IB-MA->ES-IB-ME':
163             net_flow = response.link['ma_me']
164         elif sorted_zone_keys == 'ES-IB-IZ->ES-IB-MA':
165             net_flow = response.link['ma_ib']
166         elif sorted_zone_keys == 'ES-IB-FO->ES-IB-IZ':
167             net_flow = -1 * response.link['ib_fo']
168         else:
169             net_flow = response.link['pe_ma']
170 
171         exchange = {
172             'sortedZoneKeys': sorted_zone_keys,
173             'datetime': get(response.timestamp).datetime,
174             'netFlow': net_flow,
175             'source': 'demanda.ree.es',
176         }
177 
178         exchanges.append(exchange)
179 
180     return exchanges
181 
182 
183 if __name__ == '__main__':
184     session = Session
185     print("fetch_consumption(ES-IB)")
186     print(fetch_consumption('ES-IB', session))
187 
188     print("fetch_production(ES-IB)")
189     print(fetch_production('ES-IB', session))
190 
191     print("fetch_exchange(ES, ES-IB)")
192     print(fetch_exchange('ES', 'ES-IB', session))
193 
194     print("fetch_consumption(ES-IB-FO)")
195     print(fetch_consumption('ES-IB-FO'))
196     print("fetch_production(ES-IB-FO)")
197     print(fetch_production('ES-IB-FO'))
198     print("fetch_consumption(ES-IB-IZ)")
199     print(fetch_consumption('ES-IB-IZ'))
200     print("fetch_production(ES-IB-IZ)")
201     print(fetch_production('ES-IB-IZ'))
202     print("fetch_consumption(ES-IB-MA)")
203     print(fetch_consumption('ES-IB-MA'))
204     print("fetch_production(ES-IB-MA)")
205     print(fetch_production('ES-IB-MA'))
206     print("fetch_consumption(ES-IB-ME)")
207     print(fetch_consumption('ES-IB-ME'))
208     print("fetch_production(ES-IB-ME)")
209     print(fetch_production('ES-IB-ME'))
210     print("fetch_exchange(ES, ES-IB-MA)")
211     print(fetch_exchange('ES', 'ES-IB-MA'))
212     print("fetch_exchange(ES-IB-MA, ES-IB-ME)")
213     print(fetch_exchange('ES-IB-MA', 'ES-IB-ME'))
214     print("fetch_exchange(ES-IB-MA, ES-IB-IZ)")
215     print(fetch_exchange('ES-IB-MA', 'ES-IB-IZ'))
216     print("fetch_exchange(ES-IB-IZ, ES-IB-FO)")
217     print(fetch_exchange('ES-IB-IZ', 'ES-IB-FO'))
218
```
--- 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/ES_IB.py b/parsers/ES_IB.py
--- a/parsers/ES_IB.py
+++ b/parsers/ES_IB.py
@@ -160,7 +160,7 @@
     for response in responses:
 
         if sorted_zone_keys == 'ES-IB-MA->ES-IB-ME':
-            net_flow = response.link['ma_me']
+            net_flow = -1 * response.link['ma_me']
         elif sorted_zone_keys == 'ES-IB-IZ->ES-IB-MA':
             net_flow = response.link['ma_ib']
         elif sorted_zone_keys == 'ES-IB-FO->ES-IB-IZ':

{"golden_diff": "diff --git a/parsers/ES_IB.py b/parsers/ES_IB.py\n--- a/parsers/ES_IB.py\n+++ b/parsers/ES_IB.py\n@@ -160,7 +160,7 @@\n     for response in responses:\n \n         if sorted_zone_keys == 'ES-IB-MA->ES-IB-ME':\n-            net_flow = response.link['ma_me']\n+            net_flow = -1 * response.link['ma_me']\n         elif sorted_zone_keys == 'ES-IB-IZ->ES-IB-MA':\n             net_flow = response.link['ma_ib']\n         elif sorted_zone_keys == 'ES-IB-FO->ES-IB-IZ':\n", "issue": "The import/export between Menorca and Mallorca appears reversed\nOur data is showing the export going one way, but our data source is showing the reverse according to one user. See screenshots:\r\n![IMG_9768](https://user-images.githubusercontent.com/8129157/86447078-17d4b400-bd15-11ea-87da-15f44842d645.PNG)\r\n![image](https://user-images.githubusercontent.com/8129157/86447080-186d4a80-bd15-11ea-8f22-9ab474bb070b.png)\r\n\n", "before_files": [{"content": "#!/usr/bin/env python3\n\nimport logging\nfrom arrow import get\nfrom requests import Session\nfrom ree import (Formentera, Ibiza,\n                 Mallorca, Menorca,\n                 BalearicIslands)\n# package \"ree\" is used to parse data from www.ree.es // maintained on github by @hectorespert\n\nfrom .lib.exceptions import ParserException\nfrom .lib.validation import validate, validate_production_diffs\n\n## Guess we'll need to figure these out later?! Adapted from ES-CN:\n\n# Minimum valid zone demand. This is used to eliminate some cases\n# where generation for one or more modes is obviously missing.\nFLOORS = {\n    'ES-IB': 0,\n    'ES-IB-FO': 0,\n    'ES-IB-IZ': 0,\n    'ES-IB-MA': 0,\n    'ES-IB-ME': 0,\n}\n\n\ndef fetch_island_data(zone_key, session):\n    if zone_key == 'ES-IB-FO':\n        formentera_data = Formentera(session, verify=False).get_all()\n        if not formentera_data:\n            raise ParserException(zone_key, \"Formentera doesn't respond\")\n        else:\n            return formentera_data\n    elif zone_key == 'ES-IB-IZ':\n        ibiza_data = Ibiza(session, verify=False).get_all()\n        if not ibiza_data:\n            raise ParserException(zone_key, \"Party is over, Ibiza doesn't respond\")\n        else:\n            return ibiza_data\n    elif zone_key == 'ES-IB-MA':\n        mallorca_data = Mallorca(session, verify=False).get_all()\n        if not mallorca_data:\n            raise ParserException(zone_key, \"Mallorca doesn't respond\")\n        else:\n            return mallorca_data\n    elif zone_key == 'ES-IB-ME':\n        menorca_data = Menorca(session, verify=False).get_all()\n        if not menorca_data:\n            raise ParserException(zone_key, \"Menorca doesn't respond\")\n        else:\n            return menorca_data\n    elif zone_key == 'ES-IB':\n        balearic_islands = BalearicIslands(session, verify=False).get_all()\n        if not balearic_islands:\n            raise ParserException(zone_key, \"Balearic Islands doesn't respond\")\n        else:\n            return balearic_islands\n    else:\n        raise ParserException(zone_key, 'Can\\'t read this country code {0}'.format(zone_key))\n\n\ndef fetch_consumption(zone_key, session=None, target_datetime=None, logger=None):\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    ses = session or Session()\n    island_data = fetch_island_data(zone_key, ses)\n    data = []\n    for response in island_data:\n        response_data = {\n            'zoneKey': zone_key,\n            'datetime': get(response.timestamp).datetime,\n            'consumption': response.demand,\n            'source': 'demanda.ree.es'\n        }\n\n        data.append(response_data)\n\n    return data\n\n\ndef fetch_production(zone_key, session=None, target_datetime=None,\n                     logger=logging.getLogger(__name__)):\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    ses = session or Session()\n    island_data = fetch_island_data(zone_key, ses)\n    data = []\n\n    if zone_key == 'ES-IB':\n        expected_range = {'coal': (50,600)}\n    else:\n        expected_range = None\n\n    for response in island_data:\n        if response.production() >= 0:\n            response_data = {\n                'zoneKey': zone_key,\n                'datetime': get(response.timestamp).datetime,\n                'production': {\n                'coal': response.carbon,\n                'gas': round(response.gas + response.combined, 2),\n                'solar': response.solar,\n                'oil': round(response.vapor + response.diesel, 2),\n                'wind': response.wind,\n                'hydro': response.hydraulic,\n                'biomass': response.waste,\n                'nuclear': 0.0,\n                'geothermal': 0.0,\n                'unknown': response.other\n            },\n            'storage': {\n                'hydro': 0.0,\n                'battery': 0.0\n            },\n            'source': 'demanda.ree.es',\n        }\n\n            response_data = validate(response_data, logger,\n                                            floor=FLOORS[zone_key],\n                                            expected_range = expected_range)\n\n            if response_data:\n                # append if valid\n                data.append(response_data)\n\n    if len(data) > 1:\n        # granularity is 10 minutes, drops points with change in coal > 100MW\n        data = validate_production_diffs(data, {'coal': 150}, logger)\n\n    return data\n\n\ndef fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None):\n\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    sorted_zone_keys = '->'.join(sorted([zone_key1, zone_key2]))\n\n    ses = session or Session()\n\n    if sorted_zone_keys == 'ES->ES-IB':\n        responses = BalearicIslands(ses, verify=False).get_all()\n        if not responses:\n            raise ParserException(\"ES-IB\", \"No responses\")\n    elif sorted_zone_keys == 'ES->ES-IB-MA' or sorted_zone_keys == 'ES-IB-MA->ES-IB-ME' or sorted_zone_keys == 'ES-IB-IZ->ES-IB-MA':\n        responses = Mallorca(ses, verify=False).get_all()\n        if not responses:\n            raise ParserException(\"ES-IB-MA\", \"No responses\")\n    elif sorted_zone_keys == 'ES-IB-FO->ES-IB-IZ':\n        responses = Formentera(ses, verify=False).get_all()\n        if not responses:\n            raise ParserException(\"ES-IB-FO\", \"No responses\")\n    else:\n        raise NotImplementedError('This exchange pair is not implemented')\n\n    exchanges = []\n    for response in responses:\n\n        if sorted_zone_keys == 'ES-IB-MA->ES-IB-ME':\n            net_flow = response.link['ma_me']\n        elif sorted_zone_keys == 'ES-IB-IZ->ES-IB-MA':\n            net_flow = response.link['ma_ib']\n        elif sorted_zone_keys == 'ES-IB-FO->ES-IB-IZ':\n            net_flow = -1 * response.link['ib_fo']\n        else:\n            net_flow = response.link['pe_ma']\n\n        exchange = {\n            'sortedZoneKeys': sorted_zone_keys,\n            'datetime': get(response.timestamp).datetime,\n            'netFlow': net_flow,\n            'source': 'demanda.ree.es',\n        }\n\n        exchanges.append(exchange)\n\n    return exchanges\n\n\nif __name__ == '__main__':\n    session = Session\n    print(\"fetch_consumption(ES-IB)\")\n    print(fetch_consumption('ES-IB', session))\n\n    print(\"fetch_production(ES-IB)\")\n    print(fetch_production('ES-IB', session))\n\n    print(\"fetch_exchange(ES, ES-IB)\")\n    print(fetch_exchange('ES', 'ES-IB', session))\n\n    print(\"fetch_consumption(ES-IB-FO)\")\n    print(fetch_consumption('ES-IB-FO'))\n    print(\"fetch_production(ES-IB-FO)\")\n    print(fetch_production('ES-IB-FO'))\n    print(\"fetch_consumption(ES-IB-IZ)\")\n    print(fetch_consumption('ES-IB-IZ'))\n    print(\"fetch_production(ES-IB-IZ)\")\n    print(fetch_production('ES-IB-IZ'))\n    print(\"fetch_consumption(ES-IB-MA)\")\n    print(fetch_consumption('ES-IB-MA'))\n    print(\"fetch_production(ES-IB-MA)\")\n    print(fetch_production('ES-IB-MA'))\n    print(\"fetch_consumption(ES-IB-ME)\")\n    print(fetch_consumption('ES-IB-ME'))\n    print(\"fetch_production(ES-IB-ME)\")\n    print(fetch_production('ES-IB-ME'))\n    print(\"fetch_exchange(ES, ES-IB-MA)\")\n    print(fetch_exchange('ES', 'ES-IB-MA'))\n    print(\"fetch_exchange(ES-IB-MA, ES-IB-ME)\")\n    print(fetch_exchange('ES-IB-MA', 'ES-IB-ME'))\n    print(\"fetch_exchange(ES-IB-MA, ES-IB-IZ)\")\n    print(fetch_exchange('ES-IB-MA', 'ES-IB-IZ'))\n    print(\"fetch_exchange(ES-IB-IZ, ES-IB-FO)\")\n    print(fetch_exchange('ES-IB-IZ', 'ES-IB-FO'))\n", "path": "parsers/ES_IB.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n\nimport logging\nfrom arrow import get\nfrom requests import Session\nfrom ree import (Formentera, Ibiza,\n                 Mallorca, Menorca,\n                 BalearicIslands)\n# package \"ree\" is used to parse data from www.ree.es // maintained on github by @hectorespert\n\nfrom .lib.exceptions import ParserException\nfrom .lib.validation import validate, validate_production_diffs\n\n## Guess we'll need to figure these out later?! Adapted from ES-CN:\n\n# Minimum valid zone demand. This is used to eliminate some cases\n# where generation for one or more modes is obviously missing.\nFLOORS = {\n    'ES-IB': 0,\n    'ES-IB-FO': 0,\n    'ES-IB-IZ': 0,\n    'ES-IB-MA': 0,\n    'ES-IB-ME': 0,\n}\n\n\ndef fetch_island_data(zone_key, session):\n    if zone_key == 'ES-IB-FO':\n        formentera_data = Formentera(session, verify=False).get_all()\n        if not formentera_data:\n            raise ParserException(zone_key, \"Formentera doesn't respond\")\n        else:\n            return formentera_data\n    elif zone_key == 'ES-IB-IZ':\n        ibiza_data = Ibiza(session, verify=False).get_all()\n        if not ibiza_data:\n            raise ParserException(zone_key, \"Party is over, Ibiza doesn't respond\")\n        else:\n            return ibiza_data\n    elif zone_key == 'ES-IB-MA':\n        mallorca_data = Mallorca(session, verify=False).get_all()\n        if not mallorca_data:\n            raise ParserException(zone_key, \"Mallorca doesn't respond\")\n        else:\n            return mallorca_data\n    elif zone_key == 'ES-IB-ME':\n        menorca_data = Menorca(session, verify=False).get_all()\n        if not menorca_data:\n            raise ParserException(zone_key, \"Menorca doesn't respond\")\n        else:\n            return menorca_data\n    elif zone_key == 'ES-IB':\n        balearic_islands = BalearicIslands(session, verify=False).get_all()\n        if not balearic_islands:\n            raise ParserException(zone_key, \"Balearic Islands doesn't respond\")\n        else:\n            return balearic_islands\n    else:\n        raise ParserException(zone_key, 'Can\\'t read this country code {0}'.format(zone_key))\n\n\ndef fetch_consumption(zone_key, session=None, target_datetime=None, logger=None):\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    ses = session or Session()\n    island_data = fetch_island_data(zone_key, ses)\n    data = []\n    for response in island_data:\n        response_data = {\n            'zoneKey': zone_key,\n            'datetime': get(response.timestamp).datetime,\n            'consumption': response.demand,\n            'source': 'demanda.ree.es'\n        }\n\n        data.append(response_data)\n\n    return data\n\n\ndef fetch_production(zone_key, session=None, target_datetime=None,\n                     logger=logging.getLogger(__name__)):\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    ses = session or Session()\n    island_data = fetch_island_data(zone_key, ses)\n    data = []\n\n    if zone_key == 'ES-IB':\n        expected_range = {'coal': (50,600)}\n    else:\n        expected_range = None\n\n    for response in island_data:\n        if response.production() >= 0:\n            response_data = {\n                'zoneKey': zone_key,\n                'datetime': get(response.timestamp).datetime,\n                'production': {\n                'coal': response.carbon,\n                'gas': round(response.gas + response.combined, 2),\n                'solar': response.solar,\n                'oil': round(response.vapor + response.diesel, 2),\n                'wind': response.wind,\n                'hydro': response.hydraulic,\n                'biomass': response.waste,\n                'nuclear': 0.0,\n                'geothermal': 0.0,\n                'unknown': response.other\n            },\n            'storage': {\n                'hydro': 0.0,\n                'battery': 0.0\n            },\n            'source': 'demanda.ree.es',\n        }\n\n            response_data = validate(response_data, logger,\n                                            floor=FLOORS[zone_key],\n                                            expected_range = expected_range)\n\n            if response_data:\n                # append if valid\n                data.append(response_data)\n\n    if len(data) > 1:\n        # granularity is 10 minutes, drops points with change in coal > 100MW\n        data = validate_production_diffs(data, {'coal': 150}, logger)\n\n    return data\n\n\ndef fetch_exchange(zone_key1, zone_key2, session=None, target_datetime=None, logger=None):\n\n    if target_datetime:\n        raise NotImplementedError('This parser is not yet able to parse past dates')\n\n    sorted_zone_keys = '->'.join(sorted([zone_key1, zone_key2]))\n\n    ses = session or Session()\n\n    if sorted_zone_keys == 'ES->ES-IB':\n        responses = BalearicIslands(ses, verify=False).get_all()\n        if not responses:\n            raise ParserException(\"ES-IB\", \"No responses\")\n    elif sorted_zone_keys == 'ES->ES-IB-MA' or sorted_zone_keys == 'ES-IB-MA->ES-IB-ME' or sorted_zone_keys == 'ES-IB-IZ->ES-IB-MA':\n        responses = Mallorca(ses, verify=False).get_all()\n        if not responses:\n            raise ParserException(\"ES-IB-MA\", \"No responses\")\n    elif sorted_zone_keys == 'ES-IB-FO->ES-IB-IZ':\n        responses = Formentera(ses, verify=False).get_all()\n        if not responses:\n            raise ParserException(\"ES-IB-FO\", \"No responses\")\n    else:\n        raise NotImplementedError('This exchange pair is not implemented')\n\n    exchanges = []\n    for response in responses:\n\n        if sorted_zone_keys == 'ES-IB-MA->ES-IB-ME':\n            net_flow = -1 * response.link['ma_me']\n        elif sorted_zone_keys == 'ES-IB-IZ->ES-IB-MA':\n            net_flow = response.link['ma_ib']\n        elif sorted_zone_keys == 'ES-IB-FO->ES-IB-IZ':\n            net_flow = -1 * response.link['ib_fo']\n        else:\n            net_flow = response.link['pe_ma']\n\n        exchange = {\n            'sortedZoneKeys': sorted_zone_keys,\n            'datetime': get(response.timestamp).datetime,\n            'netFlow': net_flow,\n            'source': 'demanda.ree.es',\n        }\n\n        exchanges.append(exchange)\n\n    return exchanges\n\n\nif __name__ == '__main__':\n    session = Session\n    print(\"fetch_consumption(ES-IB)\")\n    print(fetch_consumption('ES-IB', session))\n\n    print(\"fetch_production(ES-IB)\")\n    print(fetch_production('ES-IB', session))\n\n    print(\"fetch_exchange(ES, ES-IB)\")\n    print(fetch_exchange('ES', 'ES-IB', session))\n\n    print(\"fetch_consumption(ES-IB-FO)\")\n    print(fetch_consumption('ES-IB-FO'))\n    print(\"fetch_production(ES-IB-FO)\")\n    print(fetch_production('ES-IB-FO'))\n    print(\"fetch_consumption(ES-IB-IZ)\")\n    print(fetch_consumption('ES-IB-IZ'))\n    print(\"fetch_production(ES-IB-IZ)\")\n    print(fetch_production('ES-IB-IZ'))\n    print(\"fetch_consumption(ES-IB-MA)\")\n    print(fetch_consumption('ES-IB-MA'))\n    print(\"fetch_production(ES-IB-MA)\")\n    print(fetch_production('ES-IB-MA'))\n    print(\"fetch_consumption(ES-IB-ME)\")\n    print(fetch_consumption('ES-IB-ME'))\n    print(\"fetch_production(ES-IB-ME)\")\n    print(fetch_production('ES-IB-ME'))\n    print(\"fetch_exchange(ES, ES-IB-MA)\")\n    print(fetch_exchange('ES', 'ES-IB-MA'))\n    print(\"fetch_exchange(ES-IB-MA, ES-IB-ME)\")\n    print(fetch_exchange('ES-IB-MA', 'ES-IB-ME'))\n    print(\"fetch_exchange(ES-IB-MA, ES-IB-IZ)\")\n    print(fetch_exchange('ES-IB-MA', 'ES-IB-IZ'))\n    print(\"fetch_exchange(ES-IB-IZ, ES-IB-FO)\")\n    print(fetch_exchange('ES-IB-IZ', 'ES-IB-FO'))\n", "path": "parsers/ES_IB.py"}]}