'Given a function and event context,
detect signature and execute, returning any result.'

@staticmethod
def run_function(app_function, event, context):

    (args, varargs, keywords, defaults) = inspect.getargspec(app_function)
    num_args = len(args)
    if (num_args == 0):
        result = (app_function(event, context) if varargs else app_function())
    elif (num_args == 1):
        result = (app_function(event, context) if varargs else app_function(event))
    elif (num_args == 2):
        result = app_function(event, context)
    else:
        raise RuntimeError(u'Function    signature    is    invalid.    Expected    a    function    that    accepts    at    most    2    arguments    or    varargs.')
    return result
