top level variables and functions. Decorator function to write bytes to the wire