def user_backends_data(user, backends, storage):
 available = list(load_backends(backends).keys())
 values = {'associated': [], 'not_associated': available, 'backends': available}
 if user_is_authenticated(user):
  associated = storage.user.get_social_auth_for_user(user)
  not_associated = list((set(available) - set((assoc.provider for assoc in associated))))
  values['associated'] = associated
  values['not_associated'] = not_associated
 return values

def user_backends_data ( user , backends , storage ) : available = list ( load_backends ( backends ) . keys ( ) ) values = { 'associated' : [ ] , 'not_associated' : available , 'backends' : available } if user_is_authenticated ( user ) : associated = storage . user . get_social_auth_for_user ( user ) not_associated = list ( ( set ( available ) - set ( ( assoc . provider for assoc in associated ) ) ) ) values [ 'associated' ] = associated values [ 'not_associated' ] = not_associated return values
will return backends data for given user .