We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`invalid_ssn` provider doesn't yield reproducible values with the same seed
* Faker version: 2.0.1
* OS: macOS 10.14.6

The `invalid_ssn` provider doesn't yield reproducible values when used with the same random seed. It's not immediately noticeable but it does show up if you generate a number of values.

### Steps to reproduce

```
Python 3.7.2 (default, Aug 29 2019, 16:32:19) 
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from faker import Faker
>>> f1 = Faker()
>>> f2 = Faker()
>>> f1.seed_instance(1); f2.seed_instance(1)
<faker.generator.Generator object at 0x10e36dcf8>
<faker.generator.Generator object at 0x10e286320>
>>> f1.invalid_ssn()
'137-97-0000'
>>> f2.invalid_ssn()
'137-97-0000'
>>> [f1.invalid_ssn() for _ in range(1000)] == [f2.invalid_ssn() for _ in range(1000)]
False
>>> f1.seed_instance(1); f2.seed_instance(1)
<faker.generator.Generator object at 0x10e36dcf8>
<faker.generator.Generator object at 0x10e286320>
>>> while True:
...   a = f1.invalid_ssn()
...   b = f2.invalid_ssn()
...   if a != b:
...     print(f"{a} != {b}")
...     break
... 
923-67-5200 != 923-69-5200
```

### Expected behavior

With the same seed `invalid_ssn` should yield the same series of values.

### Actual behavior

The series of values differ.

From briefly looking at the code I'd guess the problem is the use of `random.choice` here which would use the global RNG instead of the instance RNG:
https://github.com/joke2k/faker/blob/cfffeb82086db9d8519c8db4f93b833316062629/faker/providers/ssn/en_US/__init__.py#L199 


--- 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/ssn/en_US/__init__.py`
Content:
```
1 # coding=utf-8
2 from __future__ import unicode_literals
3 
4 import random
5 from .. import Provider as BaseProvider
6 
7 
8 class Provider(BaseProvider):
9     INVALID_SSN_TYPE = 'INVALID_SSN'
10     SSN_TYPE = 'SSN'
11     ITIN_TYPE = 'ITIN'
12     EIN_TYPE = 'EIN'
13 
14     def itin(self):
15         """Generate a random United States Individual Taxpayer Identification Number (ITIN).
16 
17         An United States Individual Taxpayer Identification Number
18         (ITIN) is a tax processing number issued by the Internal
19         Revenue Service. It is a nine-digit number that always begins
20         with the number 9 and has a range of 70-88 in the fourth and
21         fifth digit. Effective April 12, 2011, the range was extended
22         to include 900-70-0000 through 999-88-9999, 900-90-0000
23         through 999-92-9999 and 900-94-0000 through 999-99-9999.
24         https://www.irs.gov/individuals/international-taxpayers/general-itin-information
25         """
26 
27         area = self.random_int(min=900, max=999)
28         serial = self.random_int(min=0, max=9999)
29 
30         # The group number must be between 70 and 99 inclusively but not 89 or 93
31         group = random.choice([x for x in range(70, 100) if x not in [89, 93]])
32 
33         itin = "{0:03d}-{1:02d}-{2:04d}".format(area, group, serial)
34         return itin
35 
36     def ein(self):
37         """Generate a random United States Employer Identification Number (EIN).
38 
39          An United States An Employer Identification Number (EIN) is
40          also known as a Federal Tax Identification Number, and is
41          used to identify a business entity. EINs follow a format of a
42          two-digit prefix followed by a hyphen and a seven-digit sequence:
43          ##-######
44 
45          https://www.irs.gov/businesses/small-businesses-self-employed/employer-id-numbers
46         """
47 
48         # Only certain EIN Prefix values are assigned:
49         #
50         # https://www.irs.gov/businesses/small-businesses-self-employed/how-eins-are-assigned-and-valid-ein-prefixes
51 
52         ein_prefix_choices = [
53             '01',
54             '02',
55             '03',
56             '04',
57             '05',
58             '06',
59             '10',
60             '11',
61             '12',
62             '13',
63             '14',
64             '15',
65             '16',
66             '20',
67             '21',
68             '22',
69             '23',
70             '24',
71             '25',
72             '26',
73             '27',
74             '30',
75             '31',
76             '32',
77             '33',
78             '34',
79             '35',
80             '36',
81             '37',
82             '38',
83             '39',
84             '40',
85             '41',
86             '42',
87             '43',
88             '44',
89             '45',
90             '46',
91             '47',
92             '48',
93             '50',
94             '51',
95             '52',
96             '53',
97             '54',
98             '55',
99             '56',
100             '57',
101             '58',
102             '59',
103             '60',
104             '61',
105             '62',
106             '63',
107             '64',
108             '65',
109             '66',
110             '67',
111             '68',
112             '71',
113             '72',
114             '73',
115             '74',
116             '75',
117             '76',
118             '77',
119             '80',
120             '81',
121             '82',
122             '83',
123             '84',
124             '85',
125             '86',
126             '87',
127             '88',
128             '90',
129             '91',
130             '92',
131             '93',
132             '94',
133             '95',
134             '98',
135             '99']
136 
137         ein_prefix = random.choice(ein_prefix_choices)
138         sequence = self.random_int(min=0, max=9999999)
139 
140         ein = "{0:s}-{1:07d}".format(ein_prefix, sequence)
141         return ein
142 
143     def invalid_ssn(self):
144         """ Generate a random invalid United States Social Security Identification Number (SSN).
145 
146         Invalid SSNs have the following characteristics:
147         Cannot begin with the number 9
148         Cannot begin with 666 in positions 1 - 3
149         Cannot begin with 000 in positions 1 - 3
150         Cannot contain 00 in positions 4 - 5
151         Cannot contain 0000 in positions 6 - 9
152 
153         https://www.ssa.gov/kc/SSAFactSheet--IssuingSSNs.pdf
154 
155         Additionally, return an invalid SSN that is NOT a valid ITIN by excluding certain ITIN related "group" values
156         """
157         itin_group_numbers = [
158             70,
159             71,
160             72,
161             73,
162             74,
163             75,
164             76,
165             77,
166             78,
167             79,
168             80,
169             81,
170             82,
171             83,
172             84,
173             85,
174             86,
175             87,
176             88,
177             90,
178             91,
179             92,
180             94,
181             95,
182             96,
183             97,
184             98,
185             99]
186         area = self.random_int(min=0, max=999)
187         if area < 900 and area not in {666, 0}:
188             random_group_or_serial = self.random_int(min=1, max=1000)
189             if random_group_or_serial <= 500:
190                 group = 0
191                 serial = self.random_int(0, 9999)
192             else:
193                 group = self.random_int(0, 99)
194                 serial = 0
195         elif area in {666, 0}:
196             group = self.random_int(0, 99)
197             serial = self.random_int(0, 9999)
198         else:
199             group = random.choice([x for x in range(0, 100) if x not in itin_group_numbers])
200             serial = self.random_int(0, 9999)
201 
202         invalid_ssn = "{0:03d}-{1:02d}-{2:04d}".format(area, group, serial)
203         return invalid_ssn
204 
205     def ssn(self, taxpayer_identification_number_type=SSN_TYPE):
206         """ Generate a random United States Taxpayer Identification Number of the specified type.
207 
208         If no type is specified, a US SSN is returned.
209         """
210 
211         if taxpayer_identification_number_type == self.ITIN_TYPE:
212             return self.itin()
213         elif taxpayer_identification_number_type == self.EIN_TYPE:
214             return self.ein()
215         elif taxpayer_identification_number_type == self.INVALID_SSN_TYPE:
216             return self.invalid_ssn()
217         elif taxpayer_identification_number_type == self.SSN_TYPE:
218 
219             # Certain numbers are invalid for United States Social Security
220             # Numbers. The area (first 3 digits) cannot be 666 or 900-999.
221             # The group number (middle digits) cannot be 00. The serial
222             # (last 4 digits) cannot be 0000.
223 
224             area = self.random_int(min=1, max=899)
225             if area == 666:
226                 area += 1
227             group = self.random_int(1, 99)
228             serial = self.random_int(1, 9999)
229 
230             ssn = "{0:03d}-{1:02d}-{2:04d}".format(area, group, serial)
231             return ssn
232 
233         else:
234             raise ValueError("taxpayer_identification_number_type must be one of 'SSN', 'EIN', 'ITIN',"
235                              " or 'INVALID_SSN'.")
236
```
--- 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/ssn/en_US/__init__.py b/faker/providers/ssn/en_US/__init__.py
--- a/faker/providers/ssn/en_US/__init__.py
+++ b/faker/providers/ssn/en_US/__init__.py
@@ -1,7 +1,6 @@
 # coding=utf-8
 from __future__ import unicode_literals
 
-import random
 from .. import Provider as BaseProvider
 
 
@@ -28,7 +27,7 @@
         serial = self.random_int(min=0, max=9999)
 
         # The group number must be between 70 and 99 inclusively but not 89 or 93
-        group = random.choice([x for x in range(70, 100) if x not in [89, 93]])
+        group = self.random_element([x for x in range(70, 100) if x not in [89, 93]])
 
         itin = "{0:03d}-{1:02d}-{2:04d}".format(area, group, serial)
         return itin
@@ -134,7 +133,7 @@
             '98',
             '99']
 
-        ein_prefix = random.choice(ein_prefix_choices)
+        ein_prefix = self.random_element(ein_prefix_choices)
         sequence = self.random_int(min=0, max=9999999)
 
         ein = "{0:s}-{1:07d}".format(ein_prefix, sequence)
@@ -196,7 +195,7 @@
             group = self.random_int(0, 99)
             serial = self.random_int(0, 9999)
         else:
-            group = random.choice([x for x in range(0, 100) if x not in itin_group_numbers])
+            group = self.random_element([x for x in range(0, 100) if x not in itin_group_numbers])
             serial = self.random_int(0, 9999)
 
         invalid_ssn = "{0:03d}-{1:02d}-{2:04d}".format(area, group, serial)

{"golden_diff": "diff --git a/faker/providers/ssn/en_US/__init__.py b/faker/providers/ssn/en_US/__init__.py\n--- a/faker/providers/ssn/en_US/__init__.py\n+++ b/faker/providers/ssn/en_US/__init__.py\n@@ -1,7 +1,6 @@\n # coding=utf-8\n from __future__ import unicode_literals\n \n-import random\n from .. import Provider as BaseProvider\n \n \n@@ -28,7 +27,7 @@\n         serial = self.random_int(min=0, max=9999)\n \n         # The group number must be between 70 and 99 inclusively but not 89 or 93\n-        group = random.choice([x for x in range(70, 100) if x not in [89, 93]])\n+        group = self.random_element([x for x in range(70, 100) if x not in [89, 93]])\n \n         itin = \"{0:03d}-{1:02d}-{2:04d}\".format(area, group, serial)\n         return itin\n@@ -134,7 +133,7 @@\n             '98',\n             '99']\n \n-        ein_prefix = random.choice(ein_prefix_choices)\n+        ein_prefix = self.random_element(ein_prefix_choices)\n         sequence = self.random_int(min=0, max=9999999)\n \n         ein = \"{0:s}-{1:07d}\".format(ein_prefix, sequence)\n@@ -196,7 +195,7 @@\n             group = self.random_int(0, 99)\n             serial = self.random_int(0, 9999)\n         else:\n-            group = random.choice([x for x in range(0, 100) if x not in itin_group_numbers])\n+            group = self.random_element([x for x in range(0, 100) if x not in itin_group_numbers])\n             serial = self.random_int(0, 9999)\n \n         invalid_ssn = \"{0:03d}-{1:02d}-{2:04d}\".format(area, group, serial)\n", "issue": "`invalid_ssn` provider doesn't yield reproducible values with the same seed\n* Faker version: 2.0.1\r\n* OS: macOS 10.14.6\r\n\r\nThe `invalid_ssn` provider doesn't yield reproducible values when used with the same random seed. It's not immediately noticeable but it does show up if you generate a number of values.\r\n\r\n### Steps to reproduce\r\n\r\n```\r\nPython 3.7.2 (default, Aug 29 2019, 16:32:19) \r\n[Clang 10.0.1 (clang-1001.0.46.4)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> from faker import Faker\r\n>>> f1 = Faker()\r\n>>> f2 = Faker()\r\n>>> f1.seed_instance(1); f2.seed_instance(1)\r\n<faker.generator.Generator object at 0x10e36dcf8>\r\n<faker.generator.Generator object at 0x10e286320>\r\n>>> f1.invalid_ssn()\r\n'137-97-0000'\r\n>>> f2.invalid_ssn()\r\n'137-97-0000'\r\n>>> [f1.invalid_ssn() for _ in range(1000)] == [f2.invalid_ssn() for _ in range(1000)]\r\nFalse\r\n>>> f1.seed_instance(1); f2.seed_instance(1)\r\n<faker.generator.Generator object at 0x10e36dcf8>\r\n<faker.generator.Generator object at 0x10e286320>\r\n>>> while True:\r\n...   a = f1.invalid_ssn()\r\n...   b = f2.invalid_ssn()\r\n...   if a != b:\r\n...     print(f\"{a} != {b}\")\r\n...     break\r\n... \r\n923-67-5200 != 923-69-5200\r\n```\r\n\r\n### Expected behavior\r\n\r\nWith the same seed `invalid_ssn` should yield the same series of values.\r\n\r\n### Actual behavior\r\n\r\nThe series of values differ.\r\n\r\nFrom briefly looking at the code I'd guess the problem is the use of `random.choice` here which would use the global RNG instead of the instance RNG:\r\nhttps://github.com/joke2k/faker/blob/cfffeb82086db9d8519c8db4f93b833316062629/faker/providers/ssn/en_US/__init__.py#L199 \r\n\n", "before_files": [{"content": "# coding=utf-8\nfrom __future__ import unicode_literals\n\nimport random\nfrom .. import Provider as BaseProvider\n\n\nclass Provider(BaseProvider):\n    INVALID_SSN_TYPE = 'INVALID_SSN'\n    SSN_TYPE = 'SSN'\n    ITIN_TYPE = 'ITIN'\n    EIN_TYPE = 'EIN'\n\n    def itin(self):\n        \"\"\"Generate a random United States Individual Taxpayer Identification Number (ITIN).\n\n        An United States Individual Taxpayer Identification Number\n        (ITIN) is a tax processing number issued by the Internal\n        Revenue Service. It is a nine-digit number that always begins\n        with the number 9 and has a range of 70-88 in the fourth and\n        fifth digit. Effective April 12, 2011, the range was extended\n        to include 900-70-0000 through 999-88-9999, 900-90-0000\n        through 999-92-9999 and 900-94-0000 through 999-99-9999.\n        https://www.irs.gov/individuals/international-taxpayers/general-itin-information\n        \"\"\"\n\n        area = self.random_int(min=900, max=999)\n        serial = self.random_int(min=0, max=9999)\n\n        # The group number must be between 70 and 99 inclusively but not 89 or 93\n        group = random.choice([x for x in range(70, 100) if x not in [89, 93]])\n\n        itin = \"{0:03d}-{1:02d}-{2:04d}\".format(area, group, serial)\n        return itin\n\n    def ein(self):\n        \"\"\"Generate a random United States Employer Identification Number (EIN).\n\n         An United States An Employer Identification Number (EIN) is\n         also known as a Federal Tax Identification Number, and is\n         used to identify a business entity. EINs follow a format of a\n         two-digit prefix followed by a hyphen and a seven-digit sequence:\n         ##-######\n\n         https://www.irs.gov/businesses/small-businesses-self-employed/employer-id-numbers\n        \"\"\"\n\n        # Only certain EIN Prefix values are assigned:\n        #\n        # https://www.irs.gov/businesses/small-businesses-self-employed/how-eins-are-assigned-and-valid-ein-prefixes\n\n        ein_prefix_choices = [\n            '01',\n            '02',\n            '03',\n            '04',\n            '05',\n            '06',\n            '10',\n            '11',\n            '12',\n            '13',\n            '14',\n            '15',\n            '16',\n            '20',\n            '21',\n            '22',\n            '23',\n            '24',\n            '25',\n            '26',\n            '27',\n            '30',\n            '31',\n            '32',\n            '33',\n            '34',\n            '35',\n            '36',\n            '37',\n            '38',\n            '39',\n            '40',\n            '41',\n            '42',\n            '43',\n            '44',\n            '45',\n            '46',\n            '47',\n            '48',\n            '50',\n            '51',\n            '52',\n            '53',\n            '54',\n            '55',\n            '56',\n            '57',\n            '58',\n            '59',\n            '60',\n            '61',\n            '62',\n            '63',\n            '64',\n            '65',\n            '66',\n            '67',\n            '68',\n            '71',\n            '72',\n            '73',\n            '74',\n            '75',\n            '76',\n            '77',\n            '80',\n            '81',\n            '82',\n            '83',\n            '84',\n            '85',\n            '86',\n            '87',\n            '88',\n            '90',\n            '91',\n            '92',\n            '93',\n            '94',\n            '95',\n            '98',\n            '99']\n\n        ein_prefix = random.choice(ein_prefix_choices)\n        sequence = self.random_int(min=0, max=9999999)\n\n        ein = \"{0:s}-{1:07d}\".format(ein_prefix, sequence)\n        return ein\n\n    def invalid_ssn(self):\n        \"\"\" Generate a random invalid United States Social Security Identification Number (SSN).\n\n        Invalid SSNs have the following characteristics:\n        Cannot begin with the number 9\n        Cannot begin with 666 in positions 1 - 3\n        Cannot begin with 000 in positions 1 - 3\n        Cannot contain 00 in positions 4 - 5\n        Cannot contain 0000 in positions 6 - 9\n\n        https://www.ssa.gov/kc/SSAFactSheet--IssuingSSNs.pdf\n\n        Additionally, return an invalid SSN that is NOT a valid ITIN by excluding certain ITIN related \"group\" values\n        \"\"\"\n        itin_group_numbers = [\n            70,\n            71,\n            72,\n            73,\n            74,\n            75,\n            76,\n            77,\n            78,\n            79,\n            80,\n            81,\n            82,\n            83,\n            84,\n            85,\n            86,\n            87,\n            88,\n            90,\n            91,\n            92,\n            94,\n            95,\n            96,\n            97,\n            98,\n            99]\n        area = self.random_int(min=0, max=999)\n        if area < 900 and area not in {666, 0}:\n            random_group_or_serial = self.random_int(min=1, max=1000)\n            if random_group_or_serial <= 500:\n                group = 0\n                serial = self.random_int(0, 9999)\n            else:\n                group = self.random_int(0, 99)\n                serial = 0\n        elif area in {666, 0}:\n            group = self.random_int(0, 99)\n            serial = self.random_int(0, 9999)\n        else:\n            group = random.choice([x for x in range(0, 100) if x not in itin_group_numbers])\n            serial = self.random_int(0, 9999)\n\n        invalid_ssn = \"{0:03d}-{1:02d}-{2:04d}\".format(area, group, serial)\n        return invalid_ssn\n\n    def ssn(self, taxpayer_identification_number_type=SSN_TYPE):\n        \"\"\" Generate a random United States Taxpayer Identification Number of the specified type.\n\n        If no type is specified, a US SSN is returned.\n        \"\"\"\n\n        if taxpayer_identification_number_type == self.ITIN_TYPE:\n            return self.itin()\n        elif taxpayer_identification_number_type == self.EIN_TYPE:\n            return self.ein()\n        elif taxpayer_identification_number_type == self.INVALID_SSN_TYPE:\n            return self.invalid_ssn()\n        elif taxpayer_identification_number_type == self.SSN_TYPE:\n\n            # Certain numbers are invalid for United States Social Security\n            # Numbers. The area (first 3 digits) cannot be 666 or 900-999.\n            # The group number (middle digits) cannot be 00. The serial\n            # (last 4 digits) cannot be 0000.\n\n            area = self.random_int(min=1, max=899)\n            if area == 666:\n                area += 1\n            group = self.random_int(1, 99)\n            serial = self.random_int(1, 9999)\n\n            ssn = \"{0:03d}-{1:02d}-{2:04d}\".format(area, group, serial)\n            return ssn\n\n        else:\n            raise ValueError(\"taxpayer_identification_number_type must be one of 'SSN', 'EIN', 'ITIN',\"\n                             \" or 'INVALID_SSN'.\")\n", "path": "faker/providers/ssn/en_US/__init__.py"}], "after_files": [{"content": "# coding=utf-8\nfrom __future__ import unicode_literals\n\nfrom .. import Provider as BaseProvider\n\n\nclass Provider(BaseProvider):\n    INVALID_SSN_TYPE = 'INVALID_SSN'\n    SSN_TYPE = 'SSN'\n    ITIN_TYPE = 'ITIN'\n    EIN_TYPE = 'EIN'\n\n    def itin(self):\n        \"\"\"Generate a random United States Individual Taxpayer Identification Number (ITIN).\n\n        An United States Individual Taxpayer Identification Number\n        (ITIN) is a tax processing number issued by the Internal\n        Revenue Service. It is a nine-digit number that always begins\n        with the number 9 and has a range of 70-88 in the fourth and\n        fifth digit. Effective April 12, 2011, the range was extended\n        to include 900-70-0000 through 999-88-9999, 900-90-0000\n        through 999-92-9999 and 900-94-0000 through 999-99-9999.\n        https://www.irs.gov/individuals/international-taxpayers/general-itin-information\n        \"\"\"\n\n        area = self.random_int(min=900, max=999)\n        serial = self.random_int(min=0, max=9999)\n\n        # The group number must be between 70 and 99 inclusively but not 89 or 93\n        group = self.random_element([x for x in range(70, 100) if x not in [89, 93]])\n\n        itin = \"{0:03d}-{1:02d}-{2:04d}\".format(area, group, serial)\n        return itin\n\n    def ein(self):\n        \"\"\"Generate a random United States Employer Identification Number (EIN).\n\n         An United States An Employer Identification Number (EIN) is\n         also known as a Federal Tax Identification Number, and is\n         used to identify a business entity. EINs follow a format of a\n         two-digit prefix followed by a hyphen and a seven-digit sequence:\n         ##-######\n\n         https://www.irs.gov/businesses/small-businesses-self-employed/employer-id-numbers\n        \"\"\"\n\n        # Only certain EIN Prefix values are assigned:\n        #\n        # https://www.irs.gov/businesses/small-businesses-self-employed/how-eins-are-assigned-and-valid-ein-prefixes\n\n        ein_prefix_choices = [\n            '01',\n            '02',\n            '03',\n            '04',\n            '05',\n            '06',\n            '10',\n            '11',\n            '12',\n            '13',\n            '14',\n            '15',\n            '16',\n            '20',\n            '21',\n            '22',\n            '23',\n            '24',\n            '25',\n            '26',\n            '27',\n            '30',\n            '31',\n            '32',\n            '33',\n            '34',\n            '35',\n            '36',\n            '37',\n            '38',\n            '39',\n            '40',\n            '41',\n            '42',\n            '43',\n            '44',\n            '45',\n            '46',\n            '47',\n            '48',\n            '50',\n            '51',\n            '52',\n            '53',\n            '54',\n            '55',\n            '56',\n            '57',\n            '58',\n            '59',\n            '60',\n            '61',\n            '62',\n            '63',\n            '64',\n            '65',\n            '66',\n            '67',\n            '68',\n            '71',\n            '72',\n            '73',\n            '74',\n            '75',\n            '76',\n            '77',\n            '80',\n            '81',\n            '82',\n            '83',\n            '84',\n            '85',\n            '86',\n            '87',\n            '88',\n            '90',\n            '91',\n            '92',\n            '93',\n            '94',\n            '95',\n            '98',\n            '99']\n\n        ein_prefix = self.random_element(ein_prefix_choices)\n        sequence = self.random_int(min=0, max=9999999)\n\n        ein = \"{0:s}-{1:07d}\".format(ein_prefix, sequence)\n        return ein\n\n    def invalid_ssn(self):\n        \"\"\" Generate a random invalid United States Social Security Identification Number (SSN).\n\n        Invalid SSNs have the following characteristics:\n        Cannot begin with the number 9\n        Cannot begin with 666 in positions 1 - 3\n        Cannot begin with 000 in positions 1 - 3\n        Cannot contain 00 in positions 4 - 5\n        Cannot contain 0000 in positions 6 - 9\n\n        https://www.ssa.gov/kc/SSAFactSheet--IssuingSSNs.pdf\n\n        Additionally, return an invalid SSN that is NOT a valid ITIN by excluding certain ITIN related \"group\" values\n        \"\"\"\n        itin_group_numbers = [\n            70,\n            71,\n            72,\n            73,\n            74,\n            75,\n            76,\n            77,\n            78,\n            79,\n            80,\n            81,\n            82,\n            83,\n            84,\n            85,\n            86,\n            87,\n            88,\n            90,\n            91,\n            92,\n            94,\n            95,\n            96,\n            97,\n            98,\n            99]\n        area = self.random_int(min=0, max=999)\n        if area < 900 and area not in {666, 0}:\n            random_group_or_serial = self.random_int(min=1, max=1000)\n            if random_group_or_serial <= 500:\n                group = 0\n                serial = self.random_int(0, 9999)\n            else:\n                group = self.random_int(0, 99)\n                serial = 0\n        elif area in {666, 0}:\n            group = self.random_int(0, 99)\n            serial = self.random_int(0, 9999)\n        else:\n            group = self.random_element([x for x in range(0, 100) if x not in itin_group_numbers])\n            serial = self.random_int(0, 9999)\n\n        invalid_ssn = \"{0:03d}-{1:02d}-{2:04d}\".format(area, group, serial)\n        return invalid_ssn\n\n    def ssn(self, taxpayer_identification_number_type=SSN_TYPE):\n        \"\"\" Generate a random United States Taxpayer Identification Number of the specified type.\n\n        If no type is specified, a US SSN is returned.\n        \"\"\"\n\n        if taxpayer_identification_number_type == self.ITIN_TYPE:\n            return self.itin()\n        elif taxpayer_identification_number_type == self.EIN_TYPE:\n            return self.ein()\n        elif taxpayer_identification_number_type == self.INVALID_SSN_TYPE:\n            return self.invalid_ssn()\n        elif taxpayer_identification_number_type == self.SSN_TYPE:\n\n            # Certain numbers are invalid for United States Social Security\n            # Numbers. The area (first 3 digits) cannot be 666 or 900-999.\n            # The group number (middle digits) cannot be 00. The serial\n            # (last 4 digits) cannot be 0000.\n\n            area = self.random_int(min=1, max=899)\n            if area == 666:\n                area += 1\n            group = self.random_int(1, 99)\n            serial = self.random_int(1, 9999)\n\n            ssn = \"{0:03d}-{1:02d}-{2:04d}\".format(area, group, serial)\n            return ssn\n\n        else:\n            raise ValueError(\"taxpayer_identification_number_type must be one of 'SSN', 'EIN', 'ITIN',\"\n                             \" or 'INVALID_SSN'.\")\n", "path": "faker/providers/ssn/en_US/__init__.py"}]}