code: def rename_dimension(self, old_name, new_name):
      
      if old_name not in self.dimension_names:
        raise ValueError("Shape %s does not have dimension named %s"
                         % (self, old_name))
      return Shape(
          [Dimension(new_name, d.size) if d.name == old_name else d
           for d in self.dims])
docs: Returns a copy where one dimension is renamed.