def add_timeout_arg(a_func, timeout, **kwargs):
    """Updates a_func so that it gets called with the timeout as its final arg.

    This converts a callable, a_func, into another callable with an additional
    positional arg.

    Args:
      a_func (callable): a callable to be updated
      timeout (int): to be added to the original callable as it final positional
        arg.
      kwargs: Addtional arguments passed through to the callable.

    Returns:
      callable: the original callable updated to the timeout arg
    """

    def inner(*args):
        """Updates args with the timeout."""
        updated_args = args + (timeout,)
        return a_func(*updated_args, **kwargs)

    return inner
def add_timeout_arg ( a_func , timeout , ** kwargs ) : def inner ( * args ) : updated_args = args + ( timeout , ) return a_func ( * updated_args , ** kwargs ) return inner
Updates a_func so that it gets called with the timeout as its final arg.

    This converts a callable, a_func, into another callable with an additional
    positional arg.

    Args:
      a_func (callable): a callable to be updated
      timeout (int): to be added to the original callable as it final positional
        arg.
      kwargs: Addtional arguments passed through to the callable.

    Returns:
      callable: the original callable updated to the timeout arg