code: def optimize(order):
      
      if not isinstance(order, (list, tuple)):
          order = [order]
  
      for op in Operation.__subclasses__():
          for impl in order:
              if impl in op.impls:
                  op.use_impl(impl)
                  break
docs: optimize(impl)
      Tries to set the implementation type of all registered :py:class:`Operation` classes to *impl*.
      This has no effect when an op does not implement that type.
  
      The behavior is equivalent to:
  
      .. code-block:: python
  
         for op in Operation.__subclasses__():
             if impl in op.impls:
                 op.use_impl(impl)
  
      *impl* can also be a list or tuple of valid implementation types representing a preferred order.