<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def search(self, attr, value, tolerance=0):
 """Find paths with a key value match Parameters attr : str name of the attribute value : str or numerical value value of the searched attribute Keywords -------- tolerance : float tolerance used when searching for matching numerical attributes. If the value of the attribute found from the file differs from the searched value less than the tolerance, attributes are considered to be the same. Returns ------- results : list a list of all matching paths Examples -------- print(result) '/dataset1/where' print(result) '/dataset1/data2/what' '/dataset2/data2/what' '/dataset3/data2/what' '/dataset4/data2/what' '/dataset5/data2/what' """

        found_paths = []
        gen = self.attr_gen(attr)
        for path_attr_pair in gen:
            # if attribute is numerical use numerical_value_tolerance in
            # value comparison. If attribute is string require exact match
            if isinstance(path_attr_pair.value, str):
                type_name = 'str'
            else:
                type_name = path_attr_pair.value.dtype.name
            if 'int' in type_name or 'float' in type_name:
                if abs(path_attr_pair.value - value) <= tolerance:
                    found_paths.append(path_attr_pair.path)
            else:
                if path_attr_pair.value == value:
                    found_paths.append(path_attr_pair.path)

        return found_paths