Convert internal value to machine value

def i2m(self, pkt, x):
        """Convert internal value to machine value"""
        if x is None:
            x = 0
        elif isinstance(x, str):
            return bytes_encode(x)
        return x