'Packs this object into its wire format.
May normalize fields.
NOTE: If "data" has been specified, this method may actually return
*more than just a single ofp_flow_mod* in packed form.
Specifically, it may also have a barrier and an ofp_packet_out.'

def pack(self):

    po = None
    buffer_id = self.buffer_id
    if self.data:
        if (not self.data.is_complete):
            _log(warn='flow_mod    is    trying    to    include    incomplete    data')
        else:
            self.buffer_id = self.data.buffer_id
            if (self.buffer_id is None):
                po = ofp_packet_out(data=self.data)
                po.in_port = self.data.in_port
                po.actions.append(ofp_action_output(port=OFPP_TABLE))
            buffer_id = self.buffer_id
            self.buffer_id = None
    if (buffer_id is None):
        buffer_id = NO_BUFFER
    assert self._assert()
    packed = ''
    packed += ofp_header.pack(self)
    packed += self.match.pack(flow_mod=True)
    packed += struct.pack('!QHHHHLHH', self.cookie, self.command, self.idle_timeout, self.hard_timeout, self.priority, buffer_id, self.out_port, self.flags)
    for i in self.actions:
        packed += i.pack()
    if po:
        packed += ofp_barrier_request().pack()
        packed += po.pack()
    return packed
