def _arg_count ( func ):
    """ Returns the correct argument count for a specified function or method.
    """
    if (type( func ) is MethodType) and (func.im_self is not None):
        return func.func_code.co_argcount - 1
    return func.func_code.co_argcount

#-------------------------------------------------------------------------------
#  Property error handling functions:
#-------------------------------------------------------------------------------
dataset/ETHPy150Open enthought/traits/traits/trait_handlers.py/_arg_count/original