def implements(obj, interface):
 kimplements = getattr(obj, '__implements__', ())
 if (not isinstance(kimplements, (list, tuple))):
  kimplements = (kimplements,)
 for implementedinterface in kimplements:
  if issubclass(implementedinterface, interface):
   return True
 return False

def implements ( obj , interface ) : kimplements = getattr ( obj , '__implements__' , ( ) ) if ( not isinstance ( kimplements , ( list , tuple ) ) ) : kimplements = ( kimplements , ) for implementedinterface in kimplements : if issubclass ( implementedinterface , interface ) : return True return False
declare interfaces implemented by instances of a class this function is called in a class definition .