code: def optimize(self, commit=True, waitFlush=None, waitSearcher=None, maxSegments=None, handler='update'):
          
          if maxSegments:
              msg = '<optimize maxSegments="%d" />' % maxSegments
          else:
              msg = '<optimize />'
  
          return self._update(msg, commit=commit, waitFlush=waitFlush, waitSearcher=waitSearcher, handler=handler)
docs: Tells Solr to streamline the number of segments used, essentially a
          defragmentation operation.
  
          Optionally accepts ``maxSegments``. Default is ``None``.
  
          Optionally accepts ``waitFlush``. Default is ``None``.
  
          Optionally accepts ``waitSearcher``. Default is ``None``.
  
          Usage::
  
              solr.optimize()