code: def xyz(self, idx):
          
          # Not implemented for Python 3:
          # GetBinXYZ(i, x, y, z)
          nx  = self.GetNbinsX() + 2
          ny  = self.GetNbinsY() + 2
          ndim = self.GetDimension()
          if ndim < 2:
              binx = idx % nx
              biny = 0
              binz = 0
          elif ndim < 3:
              binx = idx % nx
              biny = ((idx - binx) // nx) % ny
              binz = 0
          elif ndim < 4:
              binx = idx % nx
              biny = ((idx - binx) // nx) % ny
              binz = ((idx - binx) // nx - biny) // ny
          else:
              raise NotImplementedError
          return binx, biny, binz
docs: return binx, biny, binz corresponding to the global bin number