def addMethodNamesToDict(classObj, dict, prefix, baseClass=None):
 for base in classObj.__bases__:
  addMethodNamesToDict(base, dict, prefix, baseClass)
 if ((baseClass is None) or (baseClass in classObj.__bases__)):
  for (name, method) in classObj.__dict__.items():
   optName = name[len(prefix):]
   if ((type(method) is types.FunctionType) and (name[:len(prefix)] == prefix) and len(optName)):
    dict[optName] = 1

def addMethodNamesToDict ( classObj , dict , prefix , baseClass = None ) : for base in classObj . __bases__ : addMethodNamesToDict ( base , dict , prefix , baseClass ) if ( ( baseClass is None ) or ( baseClass in classObj . __bases__ ) ) : for ( name , method ) in classObj . __dict__ . items ( ) : optName = name [ len ( prefix ) : ] if ( ( type ( method ) is types . FunctionType ) and ( name [ : len ( prefix ) ] == prefix ) and len ( optName ) ) : dict [ optName ] = 1
this goes through c{classobj} and puts method names starting with prefix in dict with a value of 1 .