<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def match_variables(self, pattern, return_type='name'):
        ''' Return columns whose names match the provided regex pattern.

        Args:
            pattern (str): A regex pattern to match all variable names against.
            return_type (str): What to return. Must be one of:
                'name': Returns a list of names of matching variables.
                'variable': Returns a list of Variable objects whose names
                match.
        '''
        pattern = re.compile(pattern)
        vars_ = [v for v in self.variables.values() if pattern.search(v.name)]
        return vars_ if return_type.startswith('var') \
            else [v.name for v in vars_]