class_docstr: Creates a new shared memory block or attaches to an existing
  shared memory block.
  
  Every shared memory block is assigned a unique name.  This enables
  one process to create a shared memory block with a particular name
  so that a different process can attach to that same shared memory
  block using that same name.
  
  As a resource for sharing data across processes, shared memory blocks
  may outlive the original process that created them.  When one process
  no longer needs access to a shared memory block that might still be
  needed by other processes, the close() method should be called.
  When a shared memory block is no longer needed by any process, the
  unlink() method should be called to ensure proper cleanup.
code: def __init__(self, name=None, create=False, size=0, *, track=True):
      if not size >= 0:
          raise ValueError("'size' must be a positive integer")
      if create:
          self._flags = _O_CREX | os.O_RDWR
          if size == 0:
              raise ValueError(
                  "'size' must be a positive number different from zero"
              )
      if name is None and not self._flags & os.O_EXCL:
          raise ValueError("'name' can only be None if create=True")
  
      self._track = track
      if _USE_POSIX:
          # POSIX Shared Memory
  
          if name is None:
              while True:
                  name = _make_filename()
                  try:
                      self._fd = _posixshmem.shm_open(
                          name, self._flags, mode=self._mode
                      )
                  except FileExistsError:
                      continue
                  self._name = name
                  break
          else:
              name = "/" + name if self._prepend_leading_slash else name
              self._fd = _posixshmem.shm_open(
                  name, self._flags, mode=self._mode
              )
              self._name = name
          try:
              if create and size:
                  os.ftruncate(self._fd, size)
              stats = os.fstat(self._fd)
              size = stats.st_size
              self._mmap = mmap.mmap(self._fd, size)
          except OSError:
              self.unlink()
              raise
          if self._track:
              resource_tracker.register(self._name, "shared_memory")
  
      else:
          # Windows Named Shared Memory
  
          if create:
              while True:
                  temp_name = _make_filename() if name is None else name
                  # Create and reserve shared memory block with this name
                  # until it can be attached to by mmap.
                  h_map = _winapi.CreateFileMapping(
                      _winapi.INVALID_HANDLE_VALUE,
                      _winapi.NULL,
                      _winapi.PAGE_READWRITE,
                      (size >> 32) & 0xFFFFFFFF,
                      size & 0xFFFFFFFF,
                      temp_name,
                  )
                  try:
                      last_error_code = _winapi.GetLastError()
                      if (
                          last_error_code
                          == _winapi.ERROR_ALREADY_EXISTS
                      ):
                          if name is not None:
                              raise FileExistsError(
                                  errno.EEXIST,
                                  os.strerror(errno.EEXIST),
                                  name,
                                  _winapi.ERROR_ALREADY_EXISTS,
                              )
                          else:
                              continue
                      self._mmap = mmap.mmap(
                          -1, size, tagname=temp_name
                      )
                  finally:
                      _winapi.CloseHandle(h_map)
                  self._name = temp_name
                  break
  
          else:
              self._name = name
              # Dynamically determine the existing named shared memory
              # block's size which is likely a multiple of mmap.PAGESIZE.
              h_map = _winapi.OpenFileMapping(
                  _winapi.FILE_MAP_READ, False, name
              )
              try:
                  p_buf = _winapi.MapViewOfFile(
                      h_map, _winapi.FILE_MAP_READ, 0, 0, 0
                  )
              finally:
                  _winapi.CloseHandle(h_map)
              try:
                  size = _winapi.VirtualQuerySize(p_buf)
              finally:
                  _winapi.UnmapViewOfFile(p_buf)
              self._mmap = mmap.mmap(-1, size, tagname=name)
  
      self._size = size
      self._buf = memoryview(self._mmap)
  
imports: from functools import partial
  import mmap
  import os
  import errno
  import struct
  import secrets
  import types
  from .None import resource_tracker
label_desc: Use image node_id 1 to create a new SharedMemory object  with example: obj = SharedMemory(name, create, size)