<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def nn_allocmsg(size, type):
    "allocate a message"
    pointer = _nn_allocmsg(size, type)
    if pointer is None:
        return None
    return _create_message(pointer, size)