<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _process_merge_request_change(self, payload, event, codebase=None):
 """ Consumes the merge_request JSON as a python object and turn it into a buildbot change. :arguments: payload Python Object that represents the JSON sent by GitLab Service Hook. """

        attrs = payload['object_attributes']
        commit = attrs['last_commit']
        when_timestamp = dateparse(commit['timestamp'])
        # @todo provide and document a way to choose between http and ssh url
        repo_url = attrs['target']['git_http_url']
        # project name from http headers is empty for me, so get it from object_attributes/target/name
        project = attrs['target']['name']

        # Filter out uninteresting events
        state = attrs['state']
        if re.match('^(closed|merged|approved)$', state):
            log.msg("GitLab MR#{}: Ignoring because state is {}".format(attrs['iid'], state))
            return []
        action = attrs['action']
        if not re.match('^(open|reopen)$', action) and not (action == "update" and "oldrev" in attrs):
            log.msg("GitLab MR#{}: Ignoring because action {} was not open or "
                    "reopen or an update that added code".format(attrs['iid'],
                                                                 action))
            return []

        changes = [{
            'author': '%s <%s>' % (commit['author']['name'],
                                   commit['author']['email']),
            'files': [],  # @todo use rest API
            'comments': "MR#{}: {}\n\n{}".format(attrs['iid'], attrs['title'], attrs['description']),
            'revision': commit['id'],
            'when_timestamp': when_timestamp,
            'branch': attrs['target_branch'],
            'repository': repo_url,
            'project': project,
            'category': event,
            'revlink': attrs['url'],
            'properties': {
                'source_branch': attrs['source_branch'],
                'source_project_id': attrs['source_project_id'],
                'source_repository': attrs['source']['git_http_url'],
                'source_git_ssh_url': attrs['source']['git_ssh_url'],
                'target_branch': attrs['target_branch'],
                'target_project_id': attrs['target_project_id'],
                'target_repository': attrs['target']['git_http_url'],
                'target_git_ssh_url': attrs['target']['git_ssh_url'],
                'event': event,
            },
        }]
        if codebase is not None:
            changes[0]['codebase'] = codebase
        return changes