<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _api_call(function):
 """ Decorator to call a pywebview API, checking for _webview_ready and raisings appropriate Exceptions on failure. """

    @wraps(function)
    def wrapper(*args, **kwargs):
        try:
            if not _webview_ready.wait(15):
                raise Exception('Main window failed to start')
            return function(*args, **kwargs)
        except NameError:
            raise Exception('Create a web view window first, before invoking this function')
        except KeyError as e:
            try:
                uid = kwargs['uid']
            except KeyError:
                # uid not passed as a keyword arg, assumes it to be last in the arg list
                uid = args[-1]
            raise Exception('Cannot call function: No webview exists with uid: {}'.format(uid))
    return wrapper