def _GetValidMain(module):
 if (not hasattr(module, 'main')):
  return None
 main = module.main
 if (not hasattr(main, '__call__')):
  return None
 defaults = main.__defaults__
 if defaults:
  default_argcount = len(defaults)
 else:
  default_argcount = 0
 if ((main.__code__.co_argcount - default_argcount) == 0):
  return main
 else:
  return None

def _GetValidMain ( module ) : if ( not hasattr ( module , 'main' ) ) : return None main = module . main if ( not hasattr ( main , '__call__' ) ) : return None defaults = main . __defaults__ if defaults : default_argcount = len ( defaults ) else : default_argcount = 0 if ( ( main . __code__ . co_argcount - default_argcount ) == 0 ) : return main else : return None
returns a main function in module if it exists and is valid or none .