for key, val in json_data['referral'].items():

                if val and '\n' in val:

                    output += generate_output(