code: def nn_recv(socket, *args):
      "receive a message"
      if len(args) == 1:
          flags, = args
          pointer = ctypes.c_void_p()
          rtn = _nn_recv(socket, ctypes.byref(pointer), ctypes.c_size_t(-1),
                         flags)
          if rtn < 0:
              return rtn, None
          else:
              return rtn, _create_message(pointer.value, rtn)
      elif len(args) == 2:
          msg_buf, flags = args
          mv_buf = memoryview(msg_buf)
          if mv_buf.readonly:
              raise TypeError('Writable buffer is required')
          rtn = _nn_recv(socket, ctypes.addressof(msg_buf), len(mv_buf), flags)
          return rtn, msg_buf nn_recv(socket, *args):
      "receive a message"
      if len(args) == 1:
          flags, = args
          pointer = ctypes.c_void_p()
          rtn = _nn_recv(socket, ctypes.byref(pointer), ctypes.c_size_t(-1),
                         flags)
          if rtn < 0:
              return rtn, None
          else:
              return rtn, _create_message(pointer.value, rtn)
      elif len(args) == 2:
          msg_buf, flags = args
          mv_buf = memoryview(msg_buf)
          if mv_buf.readonly:
              raise TypeError('Writable buffer is required')
          rtn = _nn_recv(socket, ctypes.addressof(msg_buf), len(mv_buf), flags)
          return rtn, msg_buf
docs: receive a message