<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, user, since, until, target_type, action_name):
 """ Perform GitLab query """

        if not self.user:
            self.user = self.get_user(user)
        if not self.events:
            self.events = self.user_events(self.user['id'], since, until)
        result = []
        for event in self.events:
            created_at = dateutil.parser.parse(event['created_at']).date()
            if (event['target_type'] == target_type and
                    event['action_name'] == action_name and
                    since.date <= created_at and until.date >= created_at):
                result.append(event)
        log.debug("Result: {0} fetched".format(listed(len(result), "item")))
        return result