docs: def sanitize(self):
          '''
          Check if the current settings conform to the LISP specifications and
          fix where possible.
          '''
          # The N bit is the nonce-present bit.  When this bit is set to 1,
          # the low-order 24-bits of the first 32-bits of the LISP header
          # contains a Nonce.  See Section 6.3.1 for details.  Both N and V
          # bits MUST NOT be set in the same packet.  If they are, a
          # decapsulating ETR MUST treat the "Nonce/Map-Version" field as
          # having a Nonce value present.
          if self.nonce is not None and (not isinstance(self.nonce, bytes) or
                                         len(self.nonce) != 3):
              raise ValueError('Nonce must be a None or a sequence of 3 bytes')
  
          if self.nonce is not None \
          and (self.source_map_version is not None or
               self.destination_map_version is not None):
              raise ValueError('Cannot have both a nonce and map versions')
  
          # The L bit is the Locator Status Bits field enabled bit.  When this
          # bit is set to 1, the Locator Status Bits in the second 32-bits of
          # the LISP header are in use.
          if self.lsb is not None:
              # Determine how many bits we expect
              if self.instance_id is not None:
                  lsb_bits = 8
              else:
                  lsb_bits = 32
  
              # Check if LSBs is a sequence of booleans of the right length
              if not isinstance(self.lsb, collections.Sequence) \
              or len(self.lsb) != lsb_bits \
              or any(map(lambda v: type(v) != bool, self.lsb)):
                  raise ValueError('Invalid locator status bits')
  
          # The E bit is the echo-nonce-request bit.  This bit MUST be ignored
          # and has no meaning when the N bit is set to 0.  When the N bit is
          # set to 1 and this bit is set to 1, means an ITR is requesting for
          # the nonce value in the Nonce field to be echoed back in LISP
          # encapsulated packets when the ITR is also an ETR.  See
          # Section 6.3.1 for details.
          if not isinstance(self.echo_nonce_request, bool):
              raise ValueError('Echo-Nonce-Request flag must be a boolean')
  
          if self.echo_nonce_request and self.nonce is None:
              self.echo_nonce_request = False
  
          # The V bit is the Map-Version present bit.  When this bit is set to
          # 1, the N bit MUST be 0.  Refer to Section 6.6.3 for more details.
          if self.source_map_version is not None \
          or self.destination_map_version is not None:
              if not isinstance(self.source_map_version, numbers.Integral) \
              or self.source_map_version < 0 \
              or self.source_map_version >= 2 ** 12:
                  raise ValueError('Invalid source map version')
  
              if not isinstance(self.destination_map_version, numbers.Integral) \
              or self.destination_map_version < 0 \
              or self.destination_map_version >= 2 ** 12:
                  raise ValueError('Invalid destination map version')
  
          # The I bit is the Instance ID bit.  See Section 5.5 for more
          # details.  When this bit is set to 1, the Locator Status Bits field
          # is reduced to 8-bits and the high-order 24-bits are used as an
          # Instance ID.  If the L-bit is set to 0, then the low-order 8 bits
          # are transmitted as zero and ignored on receipt.
          if self.instance_id is not None:
              if not isinstance(self.instance_id, numbers.Integral) \
              or self.instance_id < 0 \
              or self.instance_id >= 2 ** 24:
                  raise ValueError('Invalid instance id')