def parse_rate(self, rate: Optional[str]) -> Tuple[Optional[int], Optional[int]]:
        """
        Given the request rate string, return a two tuple of:
        <allowed number of requests>, <period of time in seconds>
        """
        if rate is None:
            return (None, None)

        try:
            count, rest = rate.split("/", 1)

            for unit in self._PERIODS:
                if rest.endswith(unit):
                    multi = int(rest[: -len(unit)]) if rest[: -len(unit)] else 1
                    period = self._PERIODS[unit]
                    break
            else:
                multi, period = int(rest), 1

            return int(count), multi * period

        except (ValueError, IndexError):
            raise ValueError(f"Invalid rate format: {rate}") from None

        Given the request rate string, return a two tuple of:
        <allowed number of requests>, <period of time in seconds>
        
ninja/throttling.py