parameters: (cls, prefixlen_str)
return_statement: return prefixlen
docstring: 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
docstring_summary: Return prefix length from a numeric string
docstring_tokens: Return prefix length from a numeric string
function: def _prefix_from_prefix_string(cls, prefixlen_str):
          """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
          """
          # int allows a leading +/- as well as surrounding whitespace,
          # so we ensure that isn't the case
          if not (prefixlen_str.isascii() and prefixlen_str.isdigit()):
              cls._report_invalid_netmask(prefixlen_str)
          try:
              prefixlen = int(prefixlen_str)
          except ValueError:
              cls._report_invalid_netmask(prefixlen_str)
          if not (0 <= prefixlen <= cls._max_prefixlen):
              cls._report_invalid_netmask(prefixlen_str)
          return prefixlen
function_tokens: def _prefix_from_prefix_string ( cls , prefixlen_str ) : # int allows a leading +/- as well as surrounding whitespace, # so we ensure that isn't the case if not ( prefixlen_str . isascii ( ) and prefixlen_str . isdigit ( ) ) : cls . _report_invalid_netmask ( prefixlen_str ) try : prefixlen = int ( prefixlen_str ) except ValueError : cls . _report_invalid_netmask ( prefixlen_str ) if not ( 0 <= prefixlen <= cls . _max_prefixlen ) : cls . _report_invalid_netmask ( prefixlen_str ) return prefixlen