code: def validate(self, skip_utf8_validation=False):
          
          if self.rsv1 or self.rsv2 or self.rsv3:
              raise WebSocketProtocolException("rsv is not implemented, yet")
  
          if self.opcode not in ABNF.OPCODES:
              raise WebSocketProtocolException("Invalid opcode %r", self.opcode)
  
          if self.opcode == ABNF.OPCODE_PING and not self.fin:
              raise WebSocketProtocolException("Invalid ping frame.")
  
          if self.opcode == ABNF.OPCODE_CLOSE:
              l = len(self.data)
              if not l:
                  return
              if l == 1 or l >= 126:
                  raise WebSocketProtocolException("Invalid close frame.")
              if l > 2 and not skip_utf8_validation and not validate_utf8(self.data[2:]):
                  raise WebSocketProtocolException("Invalid close frame.")
  
              code = 256 * \
                  six.byte2int(self.data[0:1]) + six.byte2int(self.data[1:2])
              if not self._is_valid_close_status(code):
                  raise WebSocketProtocolException("Invalid close opcode.")
docs: validate the ABNF frame.
          skip_utf8_validation: skip utf8 validation.