<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_getsockopt(socket, level, option, value):
 """retrieve a socket option socket - socket number level - option level option - option value - a writable byte buffer (e.g. a bytearray) which the option value will be copied to returns - number of bytes copied or on error nunber < 0 """

    if memoryview(value).readonly:
        raise TypeError('Writable buffer is required')
    size_t_size = ctypes.c_size_t(len(value))
    rtn = _nn_getsockopt(socket, level, option, ctypes.addressof(value),
                         ctypes.byref(size_t_size))
    return (rtn, size_t_size.value)