Turn a prefix length string into an integer.

        Args:
            prefixlen_str: A decimal string containing the prefix length.

        Returns:
            The prefix length as an integer.

        Raises:
            NetmaskValueError: If the input is malformed or out of range.

def _prefix_from_prefix_string(self, prefixlen_str):
        """Turn a prefix length string into an integer.

        Args:
            prefixlen_str: A decimal string containing the prefix length.

        Returns:
            The prefix length as an integer.

        Raises:
            NetmaskValueError: If the input is malformed or out of range.

        """
        try:
            if not _BaseV4._DECIMAL_DIGITS.issuperset(prefixlen_str):
                raise ValueError
            prefixlen = int(prefixlen_str)
            if not (0 <= prefixlen <= self._max_prefixlen):
               raise ValueError
        except ValueError:
            raise NetmaskValueError('%s is not a valid prefix length' %
                                    prefixlen_str)
        return prefixlen