code: def get_dimension(self, dimension, default=None, strict=False):
          
          if dimension is not None and not isinstance(dimension, (int, basestring, Dimension)):
              raise TypeError('Dimension lookup supports int, string, '
                              'and Dimension instances, cannot lookup '
                              'Dimensions using %s type.' % type(dimension).__name__)
          all_dims = self.dimensions()
          if isinstance(dimension, int):
              if 0 <= dimension < len(all_dims):
                  return all_dims[dimension]
              elif strict:
                  raise KeyError("Dimension %r not found" % dimension)
              else:
                  return default
          dimension = dimension_name(dimension)
          name_map = {dim.name: dim for dim in all_dims}
          name_map.update({dim.label: dim for dim in all_dims})
          name_map.update({util.dimension_sanitizer(dim.name): dim for dim in all_dims})
          if strict and dimension not in name_map:
              raise KeyError("Dimension %r not found." % dimension)
          else:
              return name_map.get(dimension, default)
docs: Get a Dimension object by name or index.
  
          Args:
              dimension: Dimension to look up by name or integer index
              default (optional): Value returned if Dimension not found
              strict (bool, optional): Raise a KeyError if not found
  
          Returns:
              Dimension object for the requested dimension or default