Part of the Python Social Auth Pipeline.
    Stores the result service URL reported by the LMS / LTI tool consumer so that we can use it later.

def store_report_link(backend, user, response, *args, **kwargs):
    '''
    Part of the Python Social Auth Pipeline.
    Stores the result service URL reported by the LMS / LTI tool consumer so that we can use it later.
    '''
    if backend.name is 'lti':
        assignment_pk = response.get('assignment_pk', None)
        assignment = get_object_or_404(Assignment, pk=assignment_pk)
        lti_result, created = LtiResult.objects.get_or_create(assignment=assignment, user=user)
        if created:
            logger.debug("LTI result record not found, creating it.")
        else:
            logger.debug("LTI result record found, updating it.")   # Expected, check LTI standard
        lti_result.lis_result_sourcedid = response.get('lis_result_sourcedid')
        lti_result.lis_outcome_service_url = response.get('lis_outcome_service_url')
        lti_result.save()