docs: def letter2num(letters, zbase=False):
      """A = 1, C = 3 and so on. Convert spreadsheet style column
      enumeration to a number.
  
      Answers:
      A = 1, Z = 26, AA = 27, AZ = 52, ZZ = 702, AMJ = 1024
  
      >>> from channelpack.pullxl import letter2num
  
      >>> letter2num('A') == 1
      True
      >>> letter2num('Z') == 26
      True
      >>> letter2num('AZ') == 52
      True
      >>> letter2num('ZZ') == 702
      True
      >>> letter2num('AMJ') == 1024
      True
      >>> letter2num('AMJ', zbase=True) == 1023
      True
      >>> letter2num('A', zbase=True) == 0
      True
  
      """
  
      letters = letters.upper()
      res = 0
      weight = len(letters) - 1
      assert weight >= 0, letters
      for i, c in enumerate(letters):
          assert 65 <= ord(c) <= 90, c  # A-Z
          res += (ord(c) - 64) * 26**(weight - i)
      if not zbase:
          return res
      return res - 1