def _getargs(func):
    """Return the names of all static arguments to the given function."""
    # Use this instead of importing inspect for less mem overhead.
    import types

    if isinstance(func, types.MethodType):
        func = func.__func__
    co = func.__code__
    return co.co_varnames[: co.co_argcount]
Return the names of all static arguments to the given function.
cherrypy/_cptools.py