<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_setsockopt(socket, level, option, value):
 """set a socket option socket - socket number level - option level option - option value - a readable byte buffer (not a Unicode string) containing the value returns - 0 on success or < 0 on error """

    try:
        return _nn_setsockopt(socket, level, option, ctypes.addressof(value),
                              len(value))
    except (TypeError, AttributeError):
        buf_value = ctypes.create_string_buffer(value)
        return _nn_setsockopt(socket, level, option,
                              ctypes.addressof(buf_value), len(value))