code: def get_dimension_index(self, dimension):
          
          if isinstance(dimension, int):
              if (dimension < (self.ndims + len(self.vdims)) or
                  dimension < len(self.dimensions())):
                  return dimension
              else:
                  return IndexError('Dimension index out of bounds')
          dim = dimension_name(dimension)
          try:
              dimensions = self.kdims+self.vdims
              return [i for i, d in enumerate(dimensions) if d == dim][0]
          except IndexError:
              raise Exception("Dimension %s not found in %s." %
                              (dim, self.__class__.__name__))
docs: Get the index of the requested dimension.
  
          Args:
              dimension: Dimension to look up by name or by index
  
          Returns:
              Integer index of the requested dimension