def pincode_in_state(self, state_abbr: Optional[str] = None, include_union_territories: bool = False) -> int:
        """Random PIN Code within provided state abbreviation

        :param state_abbr: State Abbr, defaults to None
        :param include_union_territories: Include Union Territories ?, defaults to False
        :raises ValueError: If incorrect state abbr
        :return: PIN Code
        """

        known_abbrs = self.states_abbr
        if include_union_territories:
            known_abbrs += self.union_territories_abbr

        if state_abbr is None:
            state_abbr = self.random_element(known_abbrs)

        if state_abbr in known_abbrs:
            codes = self.state_pincode
            if include_union_territories:
                codes.update(self.union_territories_pincode)

            pincode_range = self.random_element(codes[state_abbr])

            return self.generator.random.randint(*pincode_range)

        raise ValueError("State Abbreviation not found in list")
Random PIN Code within provided state abbreviation

        :param state_abbr: State Abbr, defaults to None
        :param include_union_territories: Include Union Territories ?, defaults to False
        :raises ValueError: If incorrect state abbr
        :return: PIN Code
        
faker/providers/address/en_IN/__init__.py