code: def invert_phase(seg, channels=(1, 1)):
      """
      channels- specifies which channel (left or right) to reverse the phase of.
      Note that mono AudioSegments will become stereo.
      """
      if channels == (1, 1):
          inverted = audioop.mul(seg._data, seg.sample_width, -1.0)
          return seg._spawn(data=inverted)
  
      else:
          if seg.channels == 2:
              left, right = seg.split_to_mono()
          else:
              raise Exception(
                  "Can't implicitly convert an AudioSegment with "
                  + str(seg.channels)
                  + " channels to stereo."
              )
  
          if channels == (1, 0):
              left = left.invert_phase()
          else:
              right = right.invert_phase()
  
          return seg.from_mono_audiosegments(left, right)
  
file_path: pydub/pydub/effects.py
imports: import sys
  import math
  import array
  from .utils import db_to_float, ratio_to_db, register_pydub_effect, make_chunks, audioop, get_min_max_value
  from .silence import split_on_silence
  from .exceptions import TooManyMissingFrames, InvalidDuration
label_desc: Use image node_id 6 for calling a global function with example usage: invert_phase(seg, channels) and returns: seg, seg