<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def take_action(self, alert, action, text, **kwargs):
 """should return internal id of external system"""


        BASE_URL = '{}/projects/{}'.format(GITLAB_URL, quote(GITLAB_PROJECT_ID, safe=''))

        if action == 'createIssue':
            if 'issue_iid' not in alert.attributes:
                url = BASE_URL + '/issues?title=' + alert.text
                r = requests.post(url, headers=self.headers)

                alert.attributes['issue_iid'] = r.json().get('iid', None)
                alert.attributes['gitlabUrl'] = '<a href="{}" target="_blank">Issue #{}</a>'.format(
                    r.json().get('web_url', None),
                    r.json().get('iid', None)
                )

        elif action == 'updateIssue':
            if 'issue_iid' in alert.attributes:
                issue_iid = alert.attributes['issue_iid']
                body = 'Update: ' + alert.text
                url = BASE_URL + '/issues/{}/discussions?body={}'.format(issue_iid, body)
                r = requests.post(url, headers=self.headers)

        return alert, action, text