def passport_number(self) -> str:
        """Generate a passport number by replacing tokens to be alphanumeric"""
        temp = re.sub(
            r"\?",
            lambda x: self.random_element(ascii_uppercase),
            self.random_element(self.passport_number_formats),
        )
        return self.numerify(temp)
Generate a passport number by replacing tokens to be alphanumeric
faker/providers/passport/__init__.py