We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
some generated UK postcodes are invalid
UK postcodes follow strict rules and there are a limited set of codes for each part of the postcode. Faker does not know about these rules and generates postcodes such as: `XC9E 1FL` and `U93 2ZU` which are invalid. See e.g. https://github.com/hamstah/ukpostcodeparser for more info.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `faker/providers/address/en_GB/__init__.py`
Content:
```
1 from __future__ import unicode_literals 
2 from ..en import Provider as AddressProvider
3 
4 
5 class Provider(AddressProvider):
6     city_prefixes = ('North', 'East', 'West', 'South', 'New', 'Lake', 'Port')
7     city_suffixes = (
8         'town', 'ton', 'land', 'ville', 'berg', 'burgh', 'borough', 'bury', 'view', 'port', 'mouth', 'stad', 'furt',
9         'chester', 'mouth', 'fort', 'haven', 'side', 'shire')
10     building_number_formats = ('#', '##', '###')
11     street_suffixes = (
12         'alley', 'avenue', 'branch', 'bridge', 'brook', 'brooks', 'burg', 'burgs', 'bypass', 'camp', 'canyon', 'cape',
13         'causeway', 'center', 'centers', 'circle', 'circles', 'cliff', 'cliffs', 'club', 'common', 'corner', 'corners',
14         'course', 'court', 'courts', 'cove', 'coves', 'creek', 'crescent', 'crest', 'crossing', 'crossroad', 'curve',
15         'dale', 'dam', 'divide', 'drive', 'drive', 'drives', 'estate', 'estates', 'expressway', 'extension',
16         'extensions',
17         'fall', 'falls', 'ferry', 'field', 'fields', 'flat', 'flats', 'ford', 'fords', 'forest', 'forge', 'forges',
18         'fork',
19         'forks', 'fort', 'freeway', 'garden', 'gardens', 'gateway', 'glen', 'glens', 'green', 'greens', 'grove',
20         'groves',
21         'harbor', 'harbors', 'haven', 'heights', 'highway', 'hill', 'hills', 'hollow', 'inlet', 'inlet', 'island',
22         'island',
23         'islands', 'islands', 'isle', 'isle', 'junction', 'junctions', 'key', 'keys', 'knoll', 'knolls', 'lake',
24         'lakes',
25         'land', 'landing', 'lane', 'light', 'lights', 'loaf', 'lock', 'locks', 'locks', 'lodge', 'lodge', 'loop',
26         'mall',
27         'manor', 'manors', 'meadow', 'meadows', 'mews', 'mill', 'mills', 'mission', 'mission', 'motorway', 'mount',
28         'mountain', 'mountain', 'mountains', 'mountains', 'neck', 'orchard', 'oval', 'overpass', 'park', 'parks',
29         'parkway',
30         'parkways', 'pass', 'passage', 'path', 'pike', 'pine', 'pines', 'place', 'plain', 'plains', 'plains', 'plaza',
31         'plaza', 'point', 'points', 'port', 'port', 'ports', 'ports', 'prairie', 'prairie', 'radial', 'ramp', 'ranch',
32         'rapid', 'rapids', 'rest', 'ridge', 'ridges', 'river', 'road', 'road', 'roads', 'roads', 'route', 'row', 'rue',
33         'run', 'shoal', 'shoals', 'shore', 'shores', 'skyway', 'spring', 'springs', 'springs', 'spur', 'spurs',
34         'square',
35         'square', 'squares', 'squares', 'station', 'station', 'stravenue', 'stravenue', 'stream', 'stream', 'street',
36         'street', 'streets', 'summit', 'summit', 'terrace', 'throughway', 'trace', 'track', 'trafficway', 'trail',
37         'trail',
38         'tunnel', 'tunnel', 'turnpike', 'turnpike', 'underpass', 'union', 'unions', 'valley', 'valleys', 'via',
39         'viaduct',
40         'view', 'views', 'village', 'village', 'villages', 'ville', 'vista', 'vista', 'walk', 'walks', 'wall', 'way',
41         'ways', 'well', 'wells')
42 
43     postcode_formats = ('??#? #??', '?#? #??', '?# #??', '?## #??', '??# #??', '??## #??',)
44 
45     city_formats = (
46         '{{city_prefix}} {{first_name}}{{city_suffix}}',
47         '{{city_prefix}} {{first_name}}',
48         '{{first_name}}{{city_suffix}}',
49         '{{last_name}}{{city_suffix}}',
50     )
51     street_name_formats = (
52         '{{first_name}} {{street_suffix}}',
53         '{{last_name}} {{street_suffix}}'
54     )
55     street_address_formats = (
56         '{{building_number}} {{street_name}}',
57         '{{secondary_address}}\n{{street_name}}',
58     )
59     address_formats = (
60         "{{street_address}}\n{{city}}\n{{postcode}}",
61     )
62     secondary_address_formats = ('Flat #', 'Flat ##', 'Flat ##?', 'Studio #', 'Studio ##', 'Studio ##?')
63 
64     @classmethod
65     def city_prefix(cls):
66         return cls.random_element(cls.city_prefixes)
67 
68     @classmethod
69     def secondary_address(cls):
70         return cls.bothify(cls.random_element(cls.secondary_address_formats))
71
```
--- 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/faker/providers/address/en_GB/__init__.py b/faker/providers/address/en_GB/__init__.py
--- a/faker/providers/address/en_GB/__init__.py
+++ b/faker/providers/address/en_GB/__init__.py
@@ -40,7 +40,44 @@
         'view', 'views', 'village', 'village', 'villages', 'ville', 'vista', 'vista', 'walk', 'walks', 'wall', 'way',
         'ways', 'well', 'wells')
 
-    postcode_formats = ('??#? #??', '?#? #??', '?# #??', '?## #??', '??# #??', '??## #??',)
+    POSTAL_ZONES = (
+        'AB', 'AL', 'B' , 'BA', 'BB', 'BD', 'BH', 'BL', 'BN', 'BR',
+        'BS', 'BT', 'CA', 'CB', 'CF', 'CH', 'CM', 'CO', 'CR', 'CT',
+        'CV', 'CW', 'DA', 'DD', 'DE', 'DG', 'DH', 'DL', 'DN', 'DT',
+        'DY', 'E' , 'EC', 'EH', 'EN', 'EX', 'FK', 'FY', 'G' , 'GL',
+        'GY', 'GU', 'HA', 'HD', 'HG', 'HP', 'HR', 'HS', 'HU', 'HX',
+        'IG', 'IM', 'IP', 'IV', 'JE', 'KA', 'KT', 'KW', 'KY', 'L' ,
+        'LA', 'LD', 'LE', 'LL', 'LN', 'LS', 'LU', 'M' , 'ME', 'MK',
+        'ML', 'N' , 'NE', 'NG', 'NN', 'NP', 'NR', 'NW', 'OL', 'OX',
+        'PA', 'PE', 'PH', 'PL', 'PO', 'PR', 'RG', 'RH', 'RM', 'S' ,
+        'SA', 'SE', 'SG', 'SK', 'SL', 'SM', 'SN', 'SO', 'SP', 'SR',
+        'SS', 'ST', 'SW', 'SY', 'TA', 'TD', 'TF', 'TN', 'TQ', 'TR',
+        'TS', 'TW', 'UB', 'W' , 'WA', 'WC', 'WD', 'WF', 'WN', 'WR',
+        'WS', 'WV', 'YO', 'ZE'
+    )
+
+    POSTAL_ZONES_ONE_CHAR = [zone for zone in POSTAL_ZONES if len(zone) == 1]
+    POSTAL_ZONES_TWO_CHARS = [zone for zone in POSTAL_ZONES if len(zone) == 2]
+
+    postcode_formats = (
+        'AN NEE',
+        'ANN NEE',
+        'PN NEE',
+        'PNN NEE',
+        'ANC NEE',
+        'PND NEE',
+    )
+
+    _postcode_sets = {
+        ' ': ' ',
+        'N': [str(i) for i in range(0, 10)],
+        'A': POSTAL_ZONES_ONE_CHAR,
+        'B': 'ABCDEFGHKLMNOPQRSTUVWXY',
+        'C': 'ABCDEFGHJKSTUW',
+        'D': 'ABEHMNPRVWXY',
+        'E': 'ABDEFGHJLNPQRSTUWXYZ',
+        'P': POSTAL_ZONES_TWO_CHARS,
+    }
 
     city_formats = (
         '{{city_prefix}} {{first_name}}{{city_suffix}}',
@@ -61,6 +98,17 @@
     )
     secondary_address_formats = ('Flat #', 'Flat ##', 'Flat ##?', 'Studio #', 'Studio ##', 'Studio ##?')
 
+    @classmethod
+    def postcode(cls):
+        """
+        See http://web.archive.org/web/20090930140939/http://www.govtalk.gov.uk/gdsc/html/noframes/PostCode-2-1-Release.htm
+        """
+        postcode = ''
+        pattern = cls.random_element(cls.postcode_formats)
+        for placeholder in pattern:
+            postcode += cls.random_element(cls._postcode_sets[placeholder])
+        return postcode
+
     @classmethod
     def city_prefix(cls):
         return cls.random_element(cls.city_prefixes)

{"golden_diff": "diff --git a/faker/providers/address/en_GB/__init__.py b/faker/providers/address/en_GB/__init__.py\n--- a/faker/providers/address/en_GB/__init__.py\n+++ b/faker/providers/address/en_GB/__init__.py\n@@ -40,7 +40,44 @@\n         'view', 'views', 'village', 'village', 'villages', 'ville', 'vista', 'vista', 'walk', 'walks', 'wall', 'way',\n         'ways', 'well', 'wells')\n \n-    postcode_formats = ('??#? #??', '?#? #??', '?# #??', '?## #??', '??# #??', '??## #??',)\n+    POSTAL_ZONES = (\n+        'AB', 'AL', 'B' , 'BA', 'BB', 'BD', 'BH', 'BL', 'BN', 'BR',\n+        'BS', 'BT', 'CA', 'CB', 'CF', 'CH', 'CM', 'CO', 'CR', 'CT',\n+        'CV', 'CW', 'DA', 'DD', 'DE', 'DG', 'DH', 'DL', 'DN', 'DT',\n+        'DY', 'E' , 'EC', 'EH', 'EN', 'EX', 'FK', 'FY', 'G' , 'GL',\n+        'GY', 'GU', 'HA', 'HD', 'HG', 'HP', 'HR', 'HS', 'HU', 'HX',\n+        'IG', 'IM', 'IP', 'IV', 'JE', 'KA', 'KT', 'KW', 'KY', 'L' ,\n+        'LA', 'LD', 'LE', 'LL', 'LN', 'LS', 'LU', 'M' , 'ME', 'MK',\n+        'ML', 'N' , 'NE', 'NG', 'NN', 'NP', 'NR', 'NW', 'OL', 'OX',\n+        'PA', 'PE', 'PH', 'PL', 'PO', 'PR', 'RG', 'RH', 'RM', 'S' ,\n+        'SA', 'SE', 'SG', 'SK', 'SL', 'SM', 'SN', 'SO', 'SP', 'SR',\n+        'SS', 'ST', 'SW', 'SY', 'TA', 'TD', 'TF', 'TN', 'TQ', 'TR',\n+        'TS', 'TW', 'UB', 'W' , 'WA', 'WC', 'WD', 'WF', 'WN', 'WR',\n+        'WS', 'WV', 'YO', 'ZE'\n+    )\n+\n+    POSTAL_ZONES_ONE_CHAR = [zone for zone in POSTAL_ZONES if len(zone) == 1]\n+    POSTAL_ZONES_TWO_CHARS = [zone for zone in POSTAL_ZONES if len(zone) == 2]\n+\n+    postcode_formats = (\n+        'AN NEE',\n+        'ANN NEE',\n+        'PN NEE',\n+        'PNN NEE',\n+        'ANC NEE',\n+        'PND NEE',\n+    )\n+\n+    _postcode_sets = {\n+        ' ': ' ',\n+        'N': [str(i) for i in range(0, 10)],\n+        'A': POSTAL_ZONES_ONE_CHAR,\n+        'B': 'ABCDEFGHKLMNOPQRSTUVWXY',\n+        'C': 'ABCDEFGHJKSTUW',\n+        'D': 'ABEHMNPRVWXY',\n+        'E': 'ABDEFGHJLNPQRSTUWXYZ',\n+        'P': POSTAL_ZONES_TWO_CHARS,\n+    }\n \n     city_formats = (\n         '{{city_prefix}} {{first_name}}{{city_suffix}}',\n@@ -61,6 +98,17 @@\n     )\n     secondary_address_formats = ('Flat #', 'Flat ##', 'Flat ##?', 'Studio #', 'Studio ##', 'Studio ##?')\n \n+    @classmethod\n+    def postcode(cls):\n+        \"\"\"\n+        See http://web.archive.org/web/20090930140939/http://www.govtalk.gov.uk/gdsc/html/noframes/PostCode-2-1-Release.htm\n+        \"\"\"\n+        postcode = ''\n+        pattern = cls.random_element(cls.postcode_formats)\n+        for placeholder in pattern:\n+            postcode += cls.random_element(cls._postcode_sets[placeholder])\n+        return postcode\n+\n     @classmethod\n     def city_prefix(cls):\n         return cls.random_element(cls.city_prefixes)\n", "issue": "some generated UK postcodes are invalid\nUK postcodes follow strict rules and there are a limited set of codes for each part of the postcode. Faker does not know about these rules and generates postcodes such as: `XC9E 1FL` and `U93 2ZU` which are invalid. See e.g. https://github.com/hamstah/ukpostcodeparser for more info.\n\n", "before_files": [{"content": "from __future__ import unicode_literals \nfrom ..en import Provider as AddressProvider\n\n\nclass Provider(AddressProvider):\n    city_prefixes = ('North', 'East', 'West', 'South', 'New', 'Lake', 'Port')\n    city_suffixes = (\n        'town', 'ton', 'land', 'ville', 'berg', 'burgh', 'borough', 'bury', 'view', 'port', 'mouth', 'stad', 'furt',\n        'chester', 'mouth', 'fort', 'haven', 'side', 'shire')\n    building_number_formats = ('#', '##', '###')\n    street_suffixes = (\n        'alley', 'avenue', 'branch', 'bridge', 'brook', 'brooks', 'burg', 'burgs', 'bypass', 'camp', 'canyon', 'cape',\n        'causeway', 'center', 'centers', 'circle', 'circles', 'cliff', 'cliffs', 'club', 'common', 'corner', 'corners',\n        'course', 'court', 'courts', 'cove', 'coves', 'creek', 'crescent', 'crest', 'crossing', 'crossroad', 'curve',\n        'dale', 'dam', 'divide', 'drive', 'drive', 'drives', 'estate', 'estates', 'expressway', 'extension',\n        'extensions',\n        'fall', 'falls', 'ferry', 'field', 'fields', 'flat', 'flats', 'ford', 'fords', 'forest', 'forge', 'forges',\n        'fork',\n        'forks', 'fort', 'freeway', 'garden', 'gardens', 'gateway', 'glen', 'glens', 'green', 'greens', 'grove',\n        'groves',\n        'harbor', 'harbors', 'haven', 'heights', 'highway', 'hill', 'hills', 'hollow', 'inlet', 'inlet', 'island',\n        'island',\n        'islands', 'islands', 'isle', 'isle', 'junction', 'junctions', 'key', 'keys', 'knoll', 'knolls', 'lake',\n        'lakes',\n        'land', 'landing', 'lane', 'light', 'lights', 'loaf', 'lock', 'locks', 'locks', 'lodge', 'lodge', 'loop',\n        'mall',\n        'manor', 'manors', 'meadow', 'meadows', 'mews', 'mill', 'mills', 'mission', 'mission', 'motorway', 'mount',\n        'mountain', 'mountain', 'mountains', 'mountains', 'neck', 'orchard', 'oval', 'overpass', 'park', 'parks',\n        'parkway',\n        'parkways', 'pass', 'passage', 'path', 'pike', 'pine', 'pines', 'place', 'plain', 'plains', 'plains', 'plaza',\n        'plaza', 'point', 'points', 'port', 'port', 'ports', 'ports', 'prairie', 'prairie', 'radial', 'ramp', 'ranch',\n        'rapid', 'rapids', 'rest', 'ridge', 'ridges', 'river', 'road', 'road', 'roads', 'roads', 'route', 'row', 'rue',\n        'run', 'shoal', 'shoals', 'shore', 'shores', 'skyway', 'spring', 'springs', 'springs', 'spur', 'spurs',\n        'square',\n        'square', 'squares', 'squares', 'station', 'station', 'stravenue', 'stravenue', 'stream', 'stream', 'street',\n        'street', 'streets', 'summit', 'summit', 'terrace', 'throughway', 'trace', 'track', 'trafficway', 'trail',\n        'trail',\n        'tunnel', 'tunnel', 'turnpike', 'turnpike', 'underpass', 'union', 'unions', 'valley', 'valleys', 'via',\n        'viaduct',\n        'view', 'views', 'village', 'village', 'villages', 'ville', 'vista', 'vista', 'walk', 'walks', 'wall', 'way',\n        'ways', 'well', 'wells')\n\n    postcode_formats = ('??#? #??', '?#? #??', '?# #??', '?## #??', '??# #??', '??## #??',)\n\n    city_formats = (\n        '{{city_prefix}} {{first_name}}{{city_suffix}}',\n        '{{city_prefix}} {{first_name}}',\n        '{{first_name}}{{city_suffix}}',\n        '{{last_name}}{{city_suffix}}',\n    )\n    street_name_formats = (\n        '{{first_name}} {{street_suffix}}',\n        '{{last_name}} {{street_suffix}}'\n    )\n    street_address_formats = (\n        '{{building_number}} {{street_name}}',\n        '{{secondary_address}}\\n{{street_name}}',\n    )\n    address_formats = (\n        \"{{street_address}}\\n{{city}}\\n{{postcode}}\",\n    )\n    secondary_address_formats = ('Flat #', 'Flat ##', 'Flat ##?', 'Studio #', 'Studio ##', 'Studio ##?')\n\n    @classmethod\n    def city_prefix(cls):\n        return cls.random_element(cls.city_prefixes)\n\n    @classmethod\n    def secondary_address(cls):\n        return cls.bothify(cls.random_element(cls.secondary_address_formats))\n", "path": "faker/providers/address/en_GB/__init__.py"}], "after_files": [{"content": "from __future__ import unicode_literals \nfrom ..en import Provider as AddressProvider\n\n\nclass Provider(AddressProvider):\n    city_prefixes = ('North', 'East', 'West', 'South', 'New', 'Lake', 'Port')\n    city_suffixes = (\n        'town', 'ton', 'land', 'ville', 'berg', 'burgh', 'borough', 'bury', 'view', 'port', 'mouth', 'stad', 'furt',\n        'chester', 'mouth', 'fort', 'haven', 'side', 'shire')\n    building_number_formats = ('#', '##', '###')\n    street_suffixes = (\n        'alley', 'avenue', 'branch', 'bridge', 'brook', 'brooks', 'burg', 'burgs', 'bypass', 'camp', 'canyon', 'cape',\n        'causeway', 'center', 'centers', 'circle', 'circles', 'cliff', 'cliffs', 'club', 'common', 'corner', 'corners',\n        'course', 'court', 'courts', 'cove', 'coves', 'creek', 'crescent', 'crest', 'crossing', 'crossroad', 'curve',\n        'dale', 'dam', 'divide', 'drive', 'drive', 'drives', 'estate', 'estates', 'expressway', 'extension',\n        'extensions',\n        'fall', 'falls', 'ferry', 'field', 'fields', 'flat', 'flats', 'ford', 'fords', 'forest', 'forge', 'forges',\n        'fork',\n        'forks', 'fort', 'freeway', 'garden', 'gardens', 'gateway', 'glen', 'glens', 'green', 'greens', 'grove',\n        'groves',\n        'harbor', 'harbors', 'haven', 'heights', 'highway', 'hill', 'hills', 'hollow', 'inlet', 'inlet', 'island',\n        'island',\n        'islands', 'islands', 'isle', 'isle', 'junction', 'junctions', 'key', 'keys', 'knoll', 'knolls', 'lake',\n        'lakes',\n        'land', 'landing', 'lane', 'light', 'lights', 'loaf', 'lock', 'locks', 'locks', 'lodge', 'lodge', 'loop',\n        'mall',\n        'manor', 'manors', 'meadow', 'meadows', 'mews', 'mill', 'mills', 'mission', 'mission', 'motorway', 'mount',\n        'mountain', 'mountain', 'mountains', 'mountains', 'neck', 'orchard', 'oval', 'overpass', 'park', 'parks',\n        'parkway',\n        'parkways', 'pass', 'passage', 'path', 'pike', 'pine', 'pines', 'place', 'plain', 'plains', 'plains', 'plaza',\n        'plaza', 'point', 'points', 'port', 'port', 'ports', 'ports', 'prairie', 'prairie', 'radial', 'ramp', 'ranch',\n        'rapid', 'rapids', 'rest', 'ridge', 'ridges', 'river', 'road', 'road', 'roads', 'roads', 'route', 'row', 'rue',\n        'run', 'shoal', 'shoals', 'shore', 'shores', 'skyway', 'spring', 'springs', 'springs', 'spur', 'spurs',\n        'square',\n        'square', 'squares', 'squares', 'station', 'station', 'stravenue', 'stravenue', 'stream', 'stream', 'street',\n        'street', 'streets', 'summit', 'summit', 'terrace', 'throughway', 'trace', 'track', 'trafficway', 'trail',\n        'trail',\n        'tunnel', 'tunnel', 'turnpike', 'turnpike', 'underpass', 'union', 'unions', 'valley', 'valleys', 'via',\n        'viaduct',\n        'view', 'views', 'village', 'village', 'villages', 'ville', 'vista', 'vista', 'walk', 'walks', 'wall', 'way',\n        'ways', 'well', 'wells')\n\n    POSTAL_ZONES = (\n        'AB', 'AL', 'B' , 'BA', 'BB', 'BD', 'BH', 'BL', 'BN', 'BR',\n        'BS', 'BT', 'CA', 'CB', 'CF', 'CH', 'CM', 'CO', 'CR', 'CT',\n        'CV', 'CW', 'DA', 'DD', 'DE', 'DG', 'DH', 'DL', 'DN', 'DT',\n        'DY', 'E' , 'EC', 'EH', 'EN', 'EX', 'FK', 'FY', 'G' , 'GL',\n        'GY', 'GU', 'HA', 'HD', 'HG', 'HP', 'HR', 'HS', 'HU', 'HX',\n        'IG', 'IM', 'IP', 'IV', 'JE', 'KA', 'KT', 'KW', 'KY', 'L' ,\n        'LA', 'LD', 'LE', 'LL', 'LN', 'LS', 'LU', 'M' , 'ME', 'MK',\n        'ML', 'N' , 'NE', 'NG', 'NN', 'NP', 'NR', 'NW', 'OL', 'OX',\n        'PA', 'PE', 'PH', 'PL', 'PO', 'PR', 'RG', 'RH', 'RM', 'S' ,\n        'SA', 'SE', 'SG', 'SK', 'SL', 'SM', 'SN', 'SO', 'SP', 'SR',\n        'SS', 'ST', 'SW', 'SY', 'TA', 'TD', 'TF', 'TN', 'TQ', 'TR',\n        'TS', 'TW', 'UB', 'W' , 'WA', 'WC', 'WD', 'WF', 'WN', 'WR',\n        'WS', 'WV', 'YO', 'ZE'\n    )\n\n    POSTAL_ZONES_ONE_CHAR = [zone for zone in POSTAL_ZONES if len(zone) == 1]\n    POSTAL_ZONES_TWO_CHARS = [zone for zone in POSTAL_ZONES if len(zone) == 2]\n\n    postcode_formats = (\n        'AN NEE',\n        'ANN NEE',\n        'PN NEE',\n        'PNN NEE',\n        'ANC NEE',\n        'PND NEE',\n    )\n\n    _postcode_sets = {\n        ' ': ' ',\n        'N': [str(i) for i in range(0, 10)],\n        'A': POSTAL_ZONES_ONE_CHAR,\n        'B': 'ABCDEFGHKLMNOPQRSTUVWXY',\n        'C': 'ABCDEFGHJKSTUW',\n        'D': 'ABEHMNPRVWXY',\n        'E': 'ABDEFGHJLNPQRSTUWXYZ',\n        'P': POSTAL_ZONES_TWO_CHARS,\n    }\n\n    city_formats = (\n        '{{city_prefix}} {{first_name}}{{city_suffix}}',\n        '{{city_prefix}} {{first_name}}',\n        '{{first_name}}{{city_suffix}}',\n        '{{last_name}}{{city_suffix}}',\n    )\n    street_name_formats = (\n        '{{first_name}} {{street_suffix}}',\n        '{{last_name}} {{street_suffix}}'\n    )\n    street_address_formats = (\n        '{{building_number}} {{street_name}}',\n        '{{secondary_address}}\\n{{street_name}}',\n    )\n    address_formats = (\n        \"{{street_address}}\\n{{city}}\\n{{postcode}}\",\n    )\n    secondary_address_formats = ('Flat #', 'Flat ##', 'Flat ##?', 'Studio #', 'Studio ##', 'Studio ##?')\n\n    @classmethod\n    def postcode(cls):\n        \"\"\"\n        See http://web.archive.org/web/20090930140939/http://www.govtalk.gov.uk/gdsc/html/noframes/PostCode-2-1-Release.htm\n        \"\"\"\n        postcode = ''\n        pattern = cls.random_element(cls.postcode_formats)\n        for placeholder in pattern:\n            postcode += cls.random_element(cls._postcode_sets[placeholder])\n        return postcode\n\n    @classmethod\n    def city_prefix(cls):\n        return cls.random_element(cls.city_prefixes)\n\n    @classmethod\n    def secondary_address(cls):\n        return cls.bothify(cls.random_element(cls.secondary_address_formats))\n", "path": "faker/providers/address/en_GB/__init__.py"}]}