'Retrieves user details from LTI parameters'

def get_user_details(self, response):

    details = {}
    lti_params = response[LTI_PARAMS_KEY]
    def add_if_exists(lti_key, details_key):
        '\n                                                Adds    LTI    parameter    to    user    details    dict    if    it    exists\n                                                '
        if ((lti_key in lti_params) and lti_params[lti_key]):
            details[details_key] = lti_params[lti_key]
    add_if_exists('email', 'email')
    add_if_exists('lis_person_name_full', 'fullname')
    add_if_exists('lis_person_name_given', 'first_name')
    add_if_exists('lis_person_name_family', 'last_name')
    return details
