def to_bytes(self):
        r'''
        Create bytes from properties

        >>> message = MapRequestMessage(itr_rlocs=[IPv4Address(u'192.0.2.1')],
        ...                       eid_prefixes=[IPv6Network(u'2001:db8::/32')])
        >>> hex = message.to_bytes().encode('hex')
        >>> hex[:40]
        '10000001000000000000000000000001c0000201'
        >>> hex[40:]
        '0020000220010db8000000000000000000000000'
        '''
        # Verify that properties make sense
        self.sanitize()

        # Start with the type
        bitstream = BitArray('uint:4=%d' % self.message_type)

        # Add the flags
        bitstream += BitArray('bool=%d, bool=%d, bool=%d, bool=%d, '
                              'bool=%d, bool=%d' % (self.authoritative,
                                                    self.map_reply is not None,
                                                    self.probe,
                                                    self.smr,
                                                    self.pitr,
                                                    self.smr_invoked))

        # Add padding
        bitstream += self._reserved1

        # Add IRC
        bitstream += BitArray('uint:5=%d' % (len(self.itr_rlocs) - 1))

        # Add record count
        bitstream += BitArray('uint:8=%d' % len(self.eid_prefixes))

        # Add the nonce
        bitstream += BitArray(bytes=self.nonce)

        # Add the source EID
        bitstream += get_bitstream_for_afi_address(self.source_eid)

        # Add the ITR RLOCs
        for itr_rloc in self.itr_rlocs:
            bitstream += get_bitstream_for_afi_address(itr_rloc)

        # Add the EIDs
        for eid_prefix in self.eid_prefixes:
            # Make sure it is a network
            eid_prefix = ip_network(eid_prefix)

            # Add padding and prefix length
            bitstream += BitArray('uint:8=0, '
                                  'uint:8=%d' % eid_prefix.prefixlen)

            # Add the address
            bitstream += get_bitstream_for_afi_address(eid_prefix)

        # Add the map-reply record if present
        if self.map_reply is not None:
            bitstream += self.map_reply.to_bitstream()

        return bitstream.bytes