def valid_status(status):
 if (not status):
  status = 200
 status = str(status)
 parts = status.split(' ', 1)
 if (len(parts) == 1):
  (code,) = parts
  reason = None
 else:
  (code, reason) = parts
  reason = reason.strip()
 try:
  code = int(code)
 except ValueError:
  raise ValueError(('Illegal response status from server (%s is non-numeric).' % repr(code)))
 if ((code < 100) or (code > 599)):
  raise ValueError(('Illegal response status from server (%s is out of range).' % repr(code)))
 if (code not in response_codes):
  (default_reason, message) = ('', '')
 else:
  (default_reason, message) = response_codes[code]
 if (reason is None):
  reason = default_reason
 return (code, reason, message)

def valid_status ( status ) : if ( not status ) : status = 200 status = str ( status ) parts = status . split ( ' ' , 1 ) if ( len ( parts ) == 1 ) : ( code , ) = parts reason = None else : ( code , reason ) = parts reason = reason . strip ( ) try : code = int ( code ) except ValueError : raise ValueError ( ( 'Illegal response status from server (%s is non-numeric).' % repr ( code ) ) ) if ( ( code < 100 ) or ( code > 599 ) ) : raise ValueError ( ( 'Illegal response status from server (%s is out of range).' % repr ( code ) ) ) if ( code not in response_codes ) : ( default_reason , message ) = ( '' , '' ) else : ( default_reason , message ) = response_codes [ code ] if ( reason is None ) : reason = default_reason return ( code , reason , message )
return legal http status code .