docs: def from_bytes(cls, bitstream):
          r'''
          Parse the given packet and update properties accordingly
  
          >>> data_hex = ('80000000'
          ...             '6e000000004811402a0086400001ffff'
          ...             '000000000000000a2a02000000000000'
          ...             '0000000000000000'
          ...             '10f610f600487396'
          ...             '10000201ee924adef97a97d700000001'
          ...             '57c3c44d00015f61535d0002200109e0'
          ...             '85000b000000000000000001000f0002'
          ...             '2a020000000000000000000000000000')
          >>> data = data_hex.decode('hex')
          >>> message = EncapsulatedControlMessage.from_bytes(data)
          >>> message.security
          False
          >>> message.ddt_originated
          False
          >>> bytes(message.payload)
          ... # doctest: +ELLIPSIS
          'n\x00\x00\x00\x00H\x11...\x00\x00'
          '''
          packet = cls()
  
          # Convert to ConstBitStream (if not already provided)
          if not isinstance(bitstream, ConstBitStream):
              if isinstance(bitstream, Bits):
                  bitstream = ConstBitStream(auto=bitstream)
              else:
                  bitstream = ConstBitStream(bytes=bitstream)
  
          # Read the type
          type_nr = bitstream.read('uint:4')
          if type_nr != packet.message_type:
              msg = 'Invalid bitstream for a {0} packet'
              class_name = packet.__class__.__name__
              raise ValueError(msg.format(class_name))
  
          # Read the flags
          (packet.security,
           packet.ddt_originated) = bitstream.readlist('2*bool')
  
          # Read reserved bits
          packet._reserved1 = bitstream.read(26)
  
          # If the security flag is set then there should be security data here
          # TODO: deal with security flag [LISP-Security]
          if packet.security:
              raise NotImplementedError('Handling security data is not ' +
                                        'implemented yet')
  
          # The rest of the packet is payload
          remaining = bitstream[bitstream.pos:]
  
          # Parse IP packet
          if len(remaining):
              ip_version = remaining.peek('uint:4')
              if ip_version == 4:
                  packet.payload = IPv4Packet.from_bytes(remaining)
              elif ip_version == 6:
                  packet.payload = IPv6Packet.from_bytes(remaining)
              else:
                  packet.payload = remaining.bytes
  
          # Verify that the properties make sense
          packet.sanitize()
  
          return packet