from inspect import signature


def check_callable(input_func, min_num_args=2):
    """Ensures the input func 1) is callable, and 2) can accept a min # of args"""

    if not callable(input_func):
        raise TypeError('Input function must be callable!')

    # would not work for C/builtin functions such as numpy.dot
    func_signature = signature(input_func)

    if len(func_signature.parameters) < min_num_args:
        raise TypeError('Input func must accept atleast {} inputs'.format(min_num_args))

    return input_func