<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_send(socket, msg, flags):
    "send a message"
    try:
        return _nn_send(socket, ctypes.addressof(msg), len(buffer(msg)), flags)
    except (TypeError, AttributeError):
        buf_msg = ctypes.create_string_buffer(msg)
        return _nn_send(socket, ctypes.addressof(buf_msg), len(msg), flags)