def _signature_str(function_name, arg_spec):
    # inspect.formatargspec can not deal with the same
    # number of arguments in python 2 and 3
    arg_spec_for_format = arg_spec[:7 if PY3_OR_LATER else 4]

    arg_spec_str = inspect.formatargspec(*arg_spec_for_format)
    return '{0}{1}'.format(function_name, arg_spec_str)
Helper function to output a function signature
dataset/ETHPy150Open scikit-learn/scikit-learn/sklearn/externals/joblib/func_inspect.py/_signature_str