<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def create_issue_link(self, type, inwardIssue, outwardIssue, comment=None):
 """Create a link between two issues. :param type: the type of link to create :param inwardIssue: the issue to link from :param outwardIssue: the issue to link to :param comment: a comment to add to the issues with the link. Should be a dict containing ``body`` and ``visibility`` fields: ``body`` being the text of the comment and ``visibility`` being a dict containing two entries: ``type`` and ``value``. ``type`` is ``role`` (or ``group`` if the JIRA server has configured comment visibility for groups) and ``value`` is the name of the role (or group) to which viewing of this comment will be restricted. :type comment: Optional[Dict[str, Any]] :rtype: Response """

        # let's see if we have the right issue link 'type' and fix it if needed
        if not hasattr(self, '_cached_issuetypes'):
            self._cached_issue_link_types = self.issue_link_types()

        if type not in self._cached_issue_link_types:
            for lt in self._cached_issue_link_types:
                if lt.outward == type:
                    # we are smart to figure it out what he meant
                    type = lt.name
                    break
                elif lt.inward == type:
                    # so that's the reverse, so we fix the request
                    type = lt.name
                    inwardIssue, outwardIssue = outwardIssue, inwardIssue
                    break

        data = {
            'type': {
                'name': type},
            'inwardIssue': {
                'key': inwardIssue},
            'outwardIssue': {
                'key': outwardIssue},
            'comment': comment}
        url = self._get_url('issueLink')
        return self._session.post(
            url, data=json.dumps(data))