code: def header_status(header):
      
      status_line = header[:header.find('\r')]
      # 'HTTP/1.1 200 OK' -> (200, 'OK')
      fields = status_line.split(None, 2)
      return int(fields[1]), fields[2]
docs: Parse HTTP status line, return status (int) and reason.