def load_platform_subclass(cls, *args, **kwargs):
 this_platform = get_platform()
 distribution = get_distribution()
 subclass = None
 if (distribution is not None):
  for sc in get_all_subclasses(cls):
   if ((sc.distribution is not None) and (sc.distribution == distribution) and (sc.platform == this_platform)):
    subclass = sc
 if (subclass is None):
  for sc in get_all_subclasses(cls):
   if ((sc.platform == this_platform) and (sc.distribution is None)):
    subclass = sc
 if (subclass is None):
  subclass = cls
 return super(cls, subclass).__new__(subclass)

def load_platform_subclass ( cls , * args , ** kwargs ) : this_platform = get_platform ( ) distribution = get_distribution ( ) subclass = None if ( distribution is not None ) : for sc in get_all_subclasses ( cls ) : if ( ( sc . distribution is not None ) and ( sc . distribution == distribution ) and ( sc . platform == this_platform ) ) : subclass = sc if ( subclass is None ) : for sc in get_all_subclasses ( cls ) : if ( ( sc . platform == this_platform ) and ( sc . distribution is None ) ) : subclass = sc if ( subclass is None ) : subclass = cls return super ( cls , subclass ) . __new__ ( subclass )
used by modules like user to have different implementations based on detected platform .