<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_var(self, query, formatted=False):
 """ Return variable names and indices matching ``query`` """


        # load the variable list to search in
        names = self._uname if formatted is False else self._fname

        found_idx, found_names = list(), list()

        for idx, name in zip(self._idx, names):
            if re.search(query, name):
                found_idx.append(idx)
                found_names.append(name)

        return found_idx, found_names