code: def to_bytes_or_none(value):
      
      if value == ffi.NULL:
          return None
      elif isinstance(value, ffi.CData):
          return ffi.string(value)
      else:
          raise ValueError('Value must be char[] or NULL')
docs: Converts C char arrays to bytes and C NULL values to None.