def pack(self):
        """
        Packs the field value into a byte string so it can be sent to the
        server.

        :param structure: The message structure class object
        :return: A byte string of the packed field's value
        """
        value = self._get_calculated_value(self.value)
        packed_value = self._pack_value(value)
        size = self._get_calculated_size(self.size, packed_value)
        if len(packed_value) != size:
            raise ValueError("Invalid packed data length for field %s of %d "
                             "does not fit field size of %d"
                             % (self.name, len(packed_value), size))

        return packed_value
Packs the field value into a byte string so it can be sent to the
        server.

        :param structure: The message structure class object
        :return: A byte string of the packed field's value