import inspect


def _get_underlying_function(item, actual_item):
    """Factors out some code used 2x, in _get_deco_wrapper and in _deco_base._class__call__
    For some class cls, and some name,
    :param item:           vars(cls)[name] == cls.__dict__[name]
    :param actual_item:    getattr(cls, name)
    :return: func, as per body
    """
    func = None
    if type(item) == staticmethod:
        func = actual_item              # == item.__func__
    elif type(item) == classmethod:
        func = actual_item.__func__     # == item.__func__
    elif inspect.isfunction(item):
        func = actual_item              # == item
    return func