'Add a remote link from an issue to an external application and returns a remote link Resource for it.
``object`` should be a dict containing at least ``url`` to the linked external URL and
``title`` to display for the link inside JIRA.
For definitions of the allowable fields for ``object`` and the keyword arguments ``globalId``, ``application``
and ``relationship``, see https://developer.atlassian.com/display/JIRADEV/JIRA+REST+API+for+Remote+Issue+Links.
:param issue: the issue to add the remote link to
:param destination: the link details to add (see the above link for details)
:param globalId: unique ID for the link (see the above link for details)
:param application: application information for the link (see the above link for details)
:param relationship: relationship description for the link (see the above link for details)'

def add_remote_link(self, issue, destination, globalId=None, application=None, relationship=None):

    try:
        applicationlinks = self.applicationlinks()
    except JIRAError as e:
        applicationlinks = []
        warnings.warn((u'Unable    to    gather    applicationlinks;    you    will    not    be    able    to    add    links    to    remote    issues:    (%s)    %s' % (e.status_code, e.text)), Warning)
    data = {}
    if isinstance(destination, Issue):
        data[u'object'] = {u'title': str(destination), u'url': destination.permalink()}
        for x in applicationlinks:
            if (x[u'application'][u'displayUrl'] == destination._options[u'server']):
                data[u'globalId'] = (u'appId=%s&issueId=%s' % (x[u'application'][u'id'], destination.raw[u'id']))
                data[u'application'] = {u'name': x[u'application'][u'name'], u'type': u'com.atlassian.jira'}
                break
        if (u'globalId' not in data):
            raise NotImplementedError(u'Unable    to    identify    the    issue    to    link    to.')
    else:
        if (globalId is not None):
            data[u'globalId'] = globalId
        if (application is not None):
            data[u'application'] = application
        data[u'object'] = destination
    if (relationship is not None):
        data[u'relationship'] = relationship
    for x in applicationlinks:
        if (x[u'application'][u'displayUrl'] == self._options[u'server']):
            data[u'globalId'] = (u'appId=%s&issueId=%s' % (x[u'application'][u'id'], destination.raw[u'id']))
            data[u'application'] = {u'name': x[u'application'][u'name'], u'type': u'com.atlassian.jira'}
            break
    url = self._get_url(((u'issue/' + str(issue)) + u'/remotelink'))
    r = self._session.post(url, data=json.dumps(data))
    remote_link = RemoteLink(self._options, self._session, raw=json_loads(r))
    return remote_link
