def METHOD_NAME(self, msg):
    """
    Allocates one chunk of memory for the entire message including
    the header which needs to be prepended. This avoids extra allocations
    and copying.
    Args:
        msg: message to be encapsulated by IPA
    Returns:
        memoryview: Allocated buf of header + length bytes.
    """
    buf = memoryview(bytearray(msg.length))
    return buf