<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter_by_cols(self, cols, ID=None):
 """ Keep only Measurements in corresponding columns. """

        rows = to_list(cols)
        fil = lambda x: x in rows
        applyto = {k: self._positions[k][1] for k in self.keys()}
        if ID is None:
            ID = self.ID + '.filtered_by_cols'
        return self.filter(fil, applyto=applyto, ID=ID)