<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def InvokeMethod(self, MethodName, ObjectName, Params=None, **params):
 # pylint: disable=invalid-name """ Invoke a method on a target instance or on a target class. The methods that can be invoked are static and non-static methods defined in a class (also known as *extrinsic* methods). Static methods can be invoked on instances and on classes. Non-static methods can be invoked only on instances. This method performs the extrinsic method invocation operation (see :term:`DSP0200`). See :ref:`WBEM operations` for a list of all methods performing such operations. If the operation succeeds, this method returns. Otherwise, this method raises an exception. Input parameters for the CIM method can be specified using the `Params` parameter, and using keyword parameters. The overall list of input parameters is formed from the list of parameters specified in `Params` (preserving their order), followed by the set of keyword parameters (not preserving their order). There is no checking for duplicate parameter names. Parameters: MethodName (:term:`string`):
 Name of the method to be invoked (case independent). ObjectName: The object path of the target object, as follows: * For instance-level use: The instance path of the target instance, as a :class:`~pywbem.CIMInstanceName` object. If this object does not specify a namespace, the default namespace of the connection is used. Its `host` attribute will be ignored. * For class-level use: The class path of the target class, as a :term:`string` or :class:`~pywbem.CIMClassName` object: If specified as a string, the string is interpreted as a class name in the default namespace of the connection (case independent). If specified as a :class:`~pywbem.CIMClassName` object, its `host` attribute will be ignored. If this object does not specify a namespace, the default namespace of the connection is used. Params (:term:`py:iterable`):
 An iterable of input parameter values for the CIM method. Each item in the iterable is a single parameter value and can be any of: * :class:`~pywbem.CIMParameter` representing a parameter value. The `name`, `value`, `type` and `embedded_object` attributes of this object are used. * tuple of name, value, with: - name (:term:`string`):
 Parameter name (case independent) - value (:term:`CIM data type`):
 Parameter value **params : Each keyword parameter is an additional input parameter value for the CIM method, with: * key (:term:`string`):
 Parameter name (case independent) * value (:term:`CIM data type`):
 Parameter value Returns: A :func:`py:tuple` of (returnvalue, outparams), with these tuple items: * returnvalue (:term:`CIM data type`):
 Return value of the CIM method. * outparams (:ref:`NocaseDict`):
 Dictionary with all provided output parameters of the CIM method, with: * key (:term:`unicode string`):
 Parameter name, preserving its lexical case * value (:term:`CIM data type`):
 Parameter value Raises: Exceptions described in :class:`~pywbem.WBEMConnection`. """


        exc = None
        result_tuple = None

        if self._operation_recorders:
            self.operation_recorder_reset()
            self.operation_recorder_stage_pywbem_args(
                method='InvokeMethod',
                MethodName=MethodName,
                ObjectName=ObjectName,
                Params=Params,
                **params)

        try:

            stats = self.statistics.start_timer('InvokeMethod')

            # Make the method call
            result = self._methodcall(MethodName, ObjectName, Params, **params)

            return result

        except (CIMXMLParseError, XMLParseError) as exce:
            exce.request_data = self.last_raw_request
            exce.response_data = self.last_raw_reply
            exc = exce
            raise
        except Exception as exce:
            exc = exce
            raise
        finally:
            self._last_operation_time = stats.stop_timer(
                self.last_request_len, self.last_reply_len,
                self.last_server_response_time, exc)
            if self._operation_recorders:
                self.operation_recorder_stage_result(result_tuple, exc)