def _getsignature2(func, skipfirst):
    if inspect is None:
        raise ImportError('inspect module not available')

    if isinstance(func, ClassTypes):
        try:
            func = func.__init__
        except __HOLE__:
            return
        skipfirst = True
    elif not isinstance(func, FunctionTypes):
        func = func.__call__

    try:
        regargs, varargs, varkwargs, defaults = inspect.getargspec(func)
    except TypeError:
        # C function / method, possibly inherited object().__init__
        return

    # instance methods and classmethods need to lose the self argument
    if getattr(func, self, None) is not None:
        regargs = regargs[1:]
    if skipfirst:
        # this condition and the above one are never both True - why?
        regargs = regargs[1:]

    signature = inspect.formatargspec(regargs, varargs, varkwargs, defaults,
                                      formatvalue=lambda value: "")
    return signature[1:-1], func
dataset/ETHPy150Open sibson/vncdotool/tests/unit/mock.py/_getsignature2