def save_avatar(strategy, details, user=None, *args, **kwargs):
if user:<EOL><INDENT>backend_name = kwargs['<STR_LIT>'].__class__.__name__.lower()<EOL>response = kwargs.get('<STR_LIT>', {})<EOL>social_thumb = None<EOL>if '<STR_LIT>' in backend_name:<EOL><INDENT>if '<STR_LIT:id>' in response:<EOL><INDENT>social_thumb = (<EOL>'<STR_LIT>'<EOL>).format(response['<STR_LIT:id>'])<EOL><DEDENT><DEDENT>elif '<STR_LIT>' in backend_name and response.get('<STR_LIT>'):<EOL><INDENT>social_thumb = response['<STR_LIT>']<EOL><DEDENT>elif '<STR_LIT>' in backend_name and response.get('<STR_LIT:image>', {}).get('<STR_LIT:url>'):<EOL><INDENT>social_thumb = response['<STR_LIT:image>']['<STR_LIT:url>'].split('<STR_LIT:?>')[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>social_thumb = '<STR_LIT>'<EOL>social_thumb += hashlib.md5(user.email.lower().encode('<STR_LIT:utf8>')).hexdigest()<EOL>social_thumb += '<STR_LIT>'<EOL><DEDENT>if social_thumb and user.social_thumb != social_thumb:<EOL><INDENT>user.social_thumb = social_thumb<EOL>strategy.storage.user.changed(user)<EOL><DEDENT><DEDENT>
Get user avatar from social provider.