docs: def bp_to_aap (bp):
      """Converts a basepol into a tuple of (ant1, ant2, pol)."""
  
      ap1, ap2 = bp
      if ap1 < 0:
          raise ValueError ('first antpol %d is negative' % ap1)
      if ap2 < 0:
          raise ValueError ('second antpol %d is negative' % ap2)
  
      pol = _fpol_to_pol[((ap1 & 0x7) << 4) + (ap2 & 0x7)]
      if pol == 0xFF:
          raise ValueError ('no CASA polarization code for pairing '
                            '%c-%c' % (fpol_names[ap1 & 0x7],
                                       fpol_names[ap2 & 0x7]))
  
      return ap1 >> 3, ap2 >> 3, pol