def load_extra_data(backend, details, response, uid, user, social_user=None, *args, **kwargs):
social_user = social_user or UserSocialAuth.get_social_auth(backend.name, uid)<EOL>if kwargs['<STR_LIT>'] and EMAIL_CONFIRMATION:<EOL><INDENT>from ..models import EmailAddress<EOL>if EmailAddress.objects.filter(email=user.email).count() < <NUM_LIT:1>:<EOL><INDENT>EmailAddress.objects.create(user=user,<EOL>email=user.email,<EOL>verified=True,<EOL>primary=True)<EOL><DEDENT><DEDENT>if social_user:<EOL><INDENT>extra_data = backend.extra_data(user, uid, response, details)<EOL>if kwargs.get('<STR_LIT>') and '<STR_LIT:email>' not in extra_data:<EOL><INDENT>extra_data['<STR_LIT:email>'] = kwargs.get('<STR_LIT>')<EOL><DEDENT>if extra_data and social_user.extra_data != extra_data:<EOL><INDENT>if social_user.extra_data:<EOL><INDENT>social_user.extra_data.update(extra_data)<EOL><DEDENT>else:<EOL><INDENT>social_user.extra_data = extra_data<EOL><DEDENT>social_user.save()<EOL><DEDENT>if backend.name == '<STR_LIT>' and kwargs['<STR_LIT>']:<EOL><INDENT>response = json.loads(requests.get('<STR_LIT>' % (extra_data['<STR_LIT:id>'], extra_data['<STR_LIT>'])).content)<EOL>try:<EOL><INDENT>user.city, user.country = response.get('<STR_LIT>').get('<STR_LIT:name>').split('<STR_LIT:U+002CU+0020>')<EOL><DEDENT>except (AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT>try:<EOL><INDENT>user.birth_date = datetime.strptime(response.get('<STR_LIT>'), '<STR_LIT>').date()<EOL><DEDENT>except (AttributeError, TypeError):<EOL><INDENT>pass<EOL><DEDENT>user.save()<EOL><DEDENT>return {'<STR_LIT>': social_user}<EOL><DEDENT>
Load extra data from provider and store it on current UserSocialAuth extra_data field.