@classmethod<EOL><INDENT>def _prefix_from_prefix_string(cls, prefixlen_str):<DEDENT>
<EOL>if not _BaseV4._DECIMAL_DIGITS.issuperset(prefixlen_str):<EOL><INDENT>cls._report_invalid_netmask(prefixlen_str)<EOL><DEDENT>try:<EOL><INDENT>prefixlen = int(prefixlen_str)<EOL><DEDENT>except ValueError:<EOL><INDENT>cls._report_invalid_netmask(prefixlen_str)<EOL><DEDENT>if not (<NUM_LIT:0> <= prefixlen <= cls._max_prefixlen):<EOL><INDENT>cls._report_invalid_netmask(prefixlen_str)<EOL><DEDENT>return prefixlen<EOL>
Return prefix length from a numeric string

        Args:
            prefixlen_str: The string to be converted

        Returns:
            An integer, the prefix length.

        Raises:
            NetmaskValueError: If the input is not a valid netmask