How to create an inventory message and send it?
You can use Peter Todd's python-bitcoinlib, which contains builders for all the network messages.

Simple example, given a list of hashes:

from bitcoin.net import *
from bitcoin.messages import *

m = msg_inv()
for h in hashes:
    assert len(h) == 32
    inv = CInv()
    inv.type = 1  # TX
    inv.hash = h
    m.inv.append(inv)

inv_msg = m.serialize()


This assumes that the list of hashes you have are little endian unhexlified strings.