<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _find_instance(iname, instance_repo):
 """ Find an instance in the instance repo by iname and return the index of that instance. Parameters: iname: CIMInstancename to find instance_repo: the instance repo to search Return (None, None if not found. Otherwise return tuple of index, instance Raises: CIMError: Failed if repo invalid. """


        rtn_inst = None
        rtn_index = None
        for index, inst in enumerate(instance_repo):
            if iname == inst.path:
                if rtn_inst is not None:
                    # TODO:ks Future Remove dup test since we should be
                    # insuring no dups on instance creation
                    raise CIMError(
                        CIM_ERR_FAILED,
                        _format("Invalid Repository. Multiple instances with "
                                "same path {0!A}.", rtn_inst.path))
                rtn_inst = inst
                rtn_index = index
        return(rtn_index, rtn_inst)