def ssn(self, taxpayer_identification_number_type: str = SSN_TYPE) -> str:
        """Generate a random United States Taxpayer Identification Number of the specified type.

        If no type is specified, a US SSN is returned.
        """

        if taxpayer_identification_number_type == self.ITIN_TYPE:
            return self.itin()
        elif taxpayer_identification_number_type == self.EIN_TYPE:
            return self.ein()
        elif taxpayer_identification_number_type == self.INVALID_SSN_TYPE:
            return self.invalid_ssn()
        elif taxpayer_identification_number_type == self.SSN_TYPE:
            # Certain numbers are invalid for United States Social Security
            # Numbers. The area (first 3 digits) cannot be 666 or 900-999.
            # The group number (middle digits) cannot be 00. The serial
            # (last 4 digits) cannot be 0000.

            area = self.random_int(min=1, max=899)
            if area == 666:
                area += 1
            group = self.random_int(1, 99)
            serial = self.random_int(1, 9999)

            ssn = f"{area:03d}-{group:02d}-{serial:04d}"
            return ssn

        else:
            raise ValueError(
                "taxpayer_identification_number_type must be one of 'SSN', 'EIN', 'ITIN', or 'INVALID_SSN'."
            )
Generate a random United States Taxpayer Identification Number of the specified type.

        If no type is specified, a US SSN is returned.
        
faker/providers/ssn/en_US/__init__.py