custom publisher in python with message size definition