docs: def sanitize(self):
          '''
          Check if the current settings conform to the LISP specifications and
          fix them where possible.
          '''
          super(MapRequestMessage, self).sanitize()
  
          # A: This is an authoritative bit, which is set to 0 for UDP-based Map-
          # Requests sent by an ITR.  Set to 1 when an ITR wants the
          # destination site to return the Map-Reply rather than the mapping
          # database system.
          if not isinstance(self.authoritative, bool):
              raise ValueError('Authoritative flag must be a boolean')
  
          # M: This is the map-data-present bit, when set, it indicates a Map-
          # Reply Record segment is included in the Map-Request.
          # Checked below
  
          # P: This is the probe-bit which indicates that a Map-Request SHOULD be
          # treated as a locator reachability probe.  The receiver SHOULD
          # respond with a Map-Reply with the probe-bit set, indicating the
          # Map-Reply is a locator reachability probe reply, with the nonce
          # copied from the Map-Request.  See Section 6.3.2 for more details.
          if not isinstance(self.probe, bool):
              raise ValueError('Probe flag must be a boolean')
  
          # S: This is the Solicit-Map-Request (SMR) bit.  See Section 6.6.2 for
          # details.
          if not isinstance(self.smr, bool):
              raise ValueError('SMR flag must be a boolean')
  
          # p: This is the PITR bit.  This bit is set to 1 when a PITR sends a
          # Map-Request.
          if not isinstance(self.pitr, bool):
              raise ValueError('PITR flag must be a boolean')
  
          # s: This is the SMR-invoked bit.  This bit is set to 1 when an xTR is
          # sending a Map-Request in response to a received SMR-based Map-
          # Request.
          if not isinstance(self.smr_invoked, bool):
              raise ValueError('SMR-invoked flag must be a boolean')
  
          # IRC:  This 5-bit field is the ITR-RLOC Count which encodes the
          # additional number of (ITR-RLOC-AFI, ITR-RLOC Address) fields
          # present in this message.  At least one (ITR-RLOC-AFI, ITR-RLOC-
          # Address) pair MUST be encoded.  Multiple ITR-RLOC Address fields
          # are used so a Map-Replier can select which destination address to
          # use for a Map-Reply.  The IRC value ranges from 0 to 31.  For a
          # value of 0, there is 1 ITR-RLOC address encoded, and for a value
          # of 1, there are 2 ITR-RLOC addresses encoded and so on up to 31
          # which encodes a total of 32 ITR-RLOC addresses.
          if len(self.itr_rlocs) < 1 or len(self.itr_rlocs) > 32:
              raise ValueError('Number of ITR RLOCs must be between 1 and 32')
  
          # Record Count:  The number of records in this Map-Request message.  A
          # record is comprised of the portion of the packet that is labeled
          # 'Rec' above and occurs the number of times equal to Record Count.
          # For this version of the protocol, a receiver MUST accept and
          # process Map-Requests that contain one or more records, but a
          # sender MUST only send Map-Requests containing one record.  Support
          # for requesting multiple EIDs in a single Map-Request message will
          # be specified in a future version of the protocol.
          if len(self.eid_prefixes) < 1 or len(self.eid_prefixes) > 32:
              raise ValueError('Number of EID prefix records must be between ' +
                               '1 and 255')
  
          # Nonce: An 8-octet random value created by the sender of the Map-
          # Request.  This nonce will be returned in the Map-Reply.  The
          # security of the LISP mapping protocol depends critically on the
          # strength of the nonce in the Map-Request message.  The nonce
          # SHOULD be generated by a properly seeded pseudo-random (or strong
          # random) source.  See [RFC4086] for advice on generating security-
          # sensitive random data.
          if len(bytes(self.nonce)) != 8:
              raise ValueError('Invalid nonce')
  
          # Source EID Address:  This is the EID of the source host which
          # originated the packet which is caused the Map-Request.  When Map-
          # Requests are used for refreshing a map-cache entry or for RLOC-
          # probing, an AFI value 0 is used and this field is of zero length.
          if self.source_eid is not None:
              # Extract the address(es)
              if isinstance(self.source_eid, LCAFAddress):
                  addresses = self.source_eid.get_addresses()
              else:
                  addresses = [self.source_eid]
  
              # We must have exactly one address
              if len(addresses) != 1:
                  raise ValueError('Source EID must be one address')
  
              if not isinstance(addresses[0], (IPv4Address, IPv6Address)):
                  raise ValueError('Invalid source EID: %r' % self.source_eid)
  
          # ITR-RLOC Address:  Used to give the ETR the option of selecting the
          # destination address from any address family for the Map-Reply
          # message.  This address MUST be a routable RLOC address of the
          # sender of the Map-Request message.
          for itr_rloc in self.itr_rlocs:
              if not isinstance(itr_rloc, (IPv4Address, IPv6Address)):
                  raise ValueError('Invalid ITR RLOC')
  
          # EID-prefix:  4 octets if an IPv4 address-family, 16 octets if an IPv6
          # address-family.  When a Map-Request is sent by an ITR because a
          # data packet is received for a destination where there is no
          # mapping entry, the EID-prefix is set to the destination IP address
          # of the data packet.  And the 'EID mask-len' is set to 32 or 128
          # for IPv4 or IPv6, respectively.  When an xTR wants to query a site
          # about the status of a mapping it already has cached, the EID-
          # prefix used in the Map-Request has the same mask-length as the
          # EID-prefix returned from the site when it sent a Map-Reply
          # message.
          for eid_prefix in self.eid_prefixes:
              # Extract the address(es)
              if isinstance(eid_prefix, LCAFAddress):
                  addresses = eid_prefix.get_addresses()
              else:
                  addresses = [eid_prefix]
  
              for address in addresses:
                  if not isinstance(address, (IPv4Network, IPv4Address,
                                              IPv6Network, IPv6Address)):
                      raise ValueError('Invalid EID prefix: %r' % address)
  
          # Map-Reply Record:  When the M bit is set, this field is the size of a
          # single "Record" in the Map-Reply format.  This Map-Reply record
          # contains the EID-to-RLOC mapping entry associated with the Source
          # EID.  This allows the ETR which will receive this Map-Request to
          # cache the data if it chooses to do so.
          if self.map_reply is not None:
              if not isinstance(self.map_reply, MapReplyRecord):
                  raise ValueError('Invalid Map-Reply')
  
              self.map_reply.sanitize()