code: def run_function(app_function, event, context):
          
          # getargspec does not support python 3 method with type hints
          # Related issue: https://github.com/Miserlou/Zappa/issues/1452
          if hasattr(inspect, "getfullargspec"):  # Python 3
              args, varargs, keywords, defaults, _, _, _ = inspect.getfullargspec(app_function)
          else:  # Python 2
              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("Function signature is invalid. Expected a function that accepts at most "
                                 "2 arguments or varargs.")
          return result
docs: Given a function and event context,
          detect signature and execute, returning any result.