code: def ConvCnstrMOD(*args, **kwargs):
      
  
      # Extract method selection argument or set default
      if 'method' in kwargs:
          method = kwargs['method']
          del kwargs['method']
      else:
          method = 'cns'
  
      # Assign base class depending on method selection argument
      if method == 'ism':
          base = ConvCnstrMOD_IterSM
      elif method == 'cg':
          base = ConvCnstrMOD_CG
      elif method == 'cns':
          base = ConvCnstrMOD_Consensus
      else:
          raise ValueError('Unknown ConvCnstrMOD solver method %s' % method)
  
      # Nested class with dynamically determined inheritance
      class ConvCnstrMOD(base):
          def __init__(self, *args, **kwargs):
              super(ConvCnstrMOD, self).__init__(*args, **kwargs)
  
      # Allow pickling of objects of type ConvCnstrMOD
      _fix_dynamic_class_lookup(ConvCnstrMOD, method)
  
      # Return object of the nested class type
      return ConvCnstrMOD(*args, **kwargs)
docs: A wrapper function that dynamically defines a class derived from
      one of the implementations of the Convolutional Constrained MOD
      problems, and returns an object instantiated with the provided
      parameters. The wrapper is designed to allow the appropriate
      object to be created by calling this function using the same
      syntax as would be used if it were a class. The specific
      implementation is selected by use of an additional keyword
      argument 'method'. Valid values are:
  
      - ``'ism'`` :
        Use the implementation defined in :class:`.ConvCnstrMOD_IterSM`. This
        method works well for a small number of training images, but is very
        slow for larger training sets.
      - ``'cg'`` :
        Use the implementation defined in :class:`.ConvCnstrMOD_CG`. This
        method is slower than ``'ism'`` for small training sets, but has better
        run time scaling as the training set grows.
      - ``'cns'`` :
        Use the implementation defined in :class:`.ConvCnstrMOD_Consensus`.
        This method is the best choice for large training sets.
  
      The default value is ``'cns'``.