def associate_user(backend, user, uid, social_user=None, *args, **kwargs):
 if (social_user or (not user)):
  return None
 try:
  social = UserSocialAuth.create_social_auth(user, uid, backend.name)
 except IntegrityError:
  return social_auth_user(backend, uid, user, social_user=social_user, *args, **kwargs)
 else:
  return {'social_user': social, 'user': social.user, 'new_association': True}

def associate_user ( backend , user , uid , social_user = None , * args , ** kwargs ) : if ( social_user or ( not user ) ) : return None try : social = UserSocialAuth . create_social_auth ( user , uid , backend . name ) except IntegrityError : return social_auth_user ( backend , uid , user , social_user = social_user , * args , ** kwargs ) else : return { 'social_user' : social , 'user' : social . user , 'new_association' : True }
associate user social account with user instance .