original_docstring: Return the state based on a string.
  
      >> lib.base.str2state('ok')
      0
      >>> lib.base.str2state('warn')
      1
      >>> lib.base.str2state('warning')
      1
      
docstring: Return the state based on a string.
docstring_tokens: Return the state based on a string .
code: def str2state(string):
      """Return the state based on a string.
  
      >> lib.base.str2state('ok')
      0
      >>> lib.base.str2state('warn')
      1
      >>> lib.base.str2state('warning')
      1
      """
      string = str(string).lower()
      if string == 'ok':
          return STATE_OK
      if string.startswith('warn'):
          return STATE_WARN
      if string.startswith('crit'):
          return STATE_CRIT
      if string.startswith('unk'):
          return STATE_UNKNOWN
code_tokens: def str2state ( string ) : string = str ( string ) . lower ( ) if string == 'ok' : return STATE_OK if string . startswith ( 'warn' ) : return STATE_WARN if string . startswith ( 'crit' ) : return STATE_CRIT if string . startswith ( 'unk' ) : return STATE_UNKNOWN
short_docstring: Return the state based on a string.
short_docstring_tokens: Return the state based on a string .
comment: """Return the state based on a string.
  
      >> lib.base.str2state('ok')
      0
      >>> lib.base.str2state('warn')
      1
      >>> lib.base.str2state('warning')
      1
      """