<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def team_matches(self, team, event=None, year=None, simple=False, keys=False):
 """ Get list of matches team has participated in. :param team: Team to get matches of. :param year: Year to get matches from. :param event: Event to get matches from. :param simple: Get only vital data. :param keys: Only get match keys rather than their full data. :return: List of string keys or Match objects. """

        if event:
            if keys:
                return self._get('team/%s/event/%s/matches/keys' % (self.team_key(team), event))
            else:
                return [Match(raw) for raw in self._get('team/%s/event/%s/matches%s' % (self.team_key(team), event, '/simple' if simple else ''))]
        elif year:
            if keys:
                return self._get('team/%s/matches/%s/keys' % (self.team_key(team), year))
            else:
                return [Match(raw) for raw in self._get('team/%s/matches/%s%s' % (self.team_key(team), year, '/simple' if simple else ''))]