def group_backend_by_type(items):
 result = defaultdict(list)
 backends_defined = get_backends()
 for item in items:
  name = getattr(item, 'provider', item)
  backend = backends_defined[name]
  if issubclass(backend, OpenIdAuth):
   result['openid'].append(item)
  elif issubclass(backend, BaseOAuth2):
   result['oauth2'].append(item)
  elif issubclass(backend, BaseOAuth1):
   result['oauth'].append(item)
 return dict(result)

def group_backend_by_type ( items ) : result = defaultdict ( list ) backends_defined = get_backends ( ) for item in items : name = getattr ( item , 'provider' , item ) backend = backends_defined [ name ] if issubclass ( backend , OpenIdAuth ) : result [ 'openid' ] . append ( item ) elif issubclass ( backend , BaseOAuth2 ) : result [ 'oauth2' ] . append ( item ) elif issubclass ( backend , BaseOAuth1 ) : result [ 'oauth' ] . append ( item ) return dict ( result )
group items by backend type .