<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def instances(self, test_type=".*"):
 """ Returns a dict of all instances defined using a regex :param test_type: Regular expression to match for self.instance['test_type'] value names """

        import re
        data = {}
        for k, v in self.instances_dict.iteritems():
            if re.match(test_type, v.get('test_type'), re.IGNORECASE):
                if 'filter_type' in v:
                    hostfilter = {
                        'filtertype': v['filter_type'],
                        'content': v['filter_value']
                    }
                else:
                    hostfilter = {}
                data[k] = {
                    'name': v.get('name'),
                    'start': v.get('start'),
                    'end': v.get('end'),
                    'url': v.get('url'),
                    'hostfilter': hostfilter,
                    'test_type': v.get('test_type')
                }
        return data