def ssn(
        self, min_age: int = 18, max_age: int = 90, gender: Optional[SexLiteral] = None, area_code: str = ""
    ) -> str:
        """
        Return 18 character chinese personal identity code

        :param gender: F for female  M for male  None for default
        :param area_code: None for default
        """

        def checksum(s):
            return str((1 - 2 * int(s, 13)) % 11).replace("10", "X")

        age = datetime.timedelta(days=self.random_int(min_age * 365, max_age * 365))
        birthday = datetime.date.today() - age
        birthday_str = birthday.strftime("%Y%m%d")

        if area_code not in self.area_codes:
            area_code = self.random_element(self.area_codes)

        ssn_without_checksum = self.numerify(area_code + birthday_str + "##")

        _number = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9")
        if gender:
            if gender in ("F", "f"):
                gender_num = self.generator.random.choice(_number[::2])
            elif gender in ("M", "m"):
                gender_num = self.generator.random.choice(_number[1::2])
            else:
                raise ValueError("Gender must be one of F or M.")
        else:
            gender_num = self.generator.random.choice(_number)
        ssn_without_checksum += gender_num
        return ssn_without_checksum + checksum(ssn_without_checksum)

        Return 18 character chinese personal identity code

        :param gender: F for female  M for male  None for default
        :param area_code: None for default
        
faker/providers/ssn/zh_CN/__init__.py