def _fake_deleteinstance(self, namespace, **params):
        """
        Implements a mock server responder for
        :meth:`~pywbem.WBEMConnection.DeleteInstance`.

        This deletes a single instance from the mock repository based on the
        iname and namespace parameters.

        It does not attempt to delete referenceing instances (associations,
        etc. that reference this instance.)

        If the creation class of the instance to be deleted is PG_Namespace or
        CIM_Namespace, then the namespace identified by the 'Name' property
        of the instance is being deleted in the mock repository in addition to
        the CIM instance. The default connection namespace of this faked
        commection cannot be deleted.
        """

        iname = params['InstanceName']
        iname.namespace = namespace

        # Validate namespace
        instance_repo = self._get_instance_repo(namespace)

        # if not repo_lite, Corresponding class must exist
        if not self._repo_lite:
            if not self._class_exists(iname.classname, namespace):
                raise CIMError(
                    CIM_ERR_INVALID_CLASS,
                    _format("Class {0!A} in namespace {1!A} not found. "
                            "Cannot delete instance {2!A}",
                            iname.classname, namespace, iname))

        del_index = None
        for i, inst in enumerate(instance_repo):
            if iname == inst.path:
                if del_index is not None:
                    raise CIMError(
                        CIM_ERR_FAILED,
                        _format("Internal Error: Invalid Repository. "
                                "Multiple instances with same path {0!A}",
                                inst.path))
                # TODO:ks Future remove this test for duplicate inst paths since
                #       we test for dups on insertion
                del_index = i

        if del_index is None:
            raise CIMError(
                CIM_ERR_NOT_FOUND,
                _format("Instance {0!A} not found in repository namespace "
                        "{1!A}", iname, namespace))

        # Handle namespace deletion, currently hard coded.
        # TODO AM 8/18 Generalize the hard coded handling into provider concept
        classname_lower = iname.classname.lower()
        if classname_lower == 'pg_namespace':
            ns_classname = 'PG_Namespace'
        elif classname_lower == 'cim_namespace':
            ns_classname = 'CIM_Namespace'
        else:
            ns_classname = None
        if ns_classname:
            namespace = iname.keybindings['Name']

            # Reflect the namespace deletion in the mock repository
            # This will check the namespace for being empty.
            self._remove_namespace(namespace)

        # Reflect the instance deletion in the mock repository
        del instance_repo[del_index]
Implements a mock server responder for
        :meth:`~pywbem.WBEMConnection.DeleteInstance`.

        This deletes a single instance from the mock repository based on the
        iname and namespace parameters.

        It does not attempt to delete referenceing instances (associations,
        etc. that reference this instance.)

        If the creation class of the instance to be deleted is PG_Namespace or
        CIM_Namespace, then the namespace identified by the 'Name' property
        of the instance is being deleted in the mock repository in addition to
        the CIM instance. The default connection namespace of this faked
        commection cannot be deleted.