input: from typing import Any
  
  
  def bitwise_conversion(x: Any, mode: str) -> int:
      """ Convert a positive integer to negative or vice versa using bitwise NOT operator.
      >>> bitwise_conversion(5, 'negative')
      -5
      >>> bitwise_conversion(-3, 'positive')
      3
      """
      if mode == 'negative':
          return ~x + 1
      elif mode == 'positive':
          return ~(x - 1)
      else:
          raise ValueError("mode must be either 'positive' or 'negative'")
output:     if not isinstance(x, int) or x < 0:
          raise ValueError("x must be a positive integer")