<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wait_for_js(function):
 """ Method decorator that waits for JavaScript dependencies before executing `function`. If the function is not a method, the decorator has no effect. Args: function (callable):
 Method to decorate. Returns: Decorated method """


    @functools.wraps(function)
    def wrapper(*args, **kwargs):  # pylint: disable=missing-docstring

        # If not a method, then just call the function
        if len(args) < 1:
            return function(*args, **kwargs)

        # Otherwise, retrieve `self` as the first arg
        else:
            self = args[0]

            # If the class has been decorated by one of the
            # JavaScript dependency decorators, it should have
            # a `wait_for_js` method
            if hasattr(self, 'wait_for_js'):
                self.wait_for_js()

            # Call the function
            return function(*args, **kwargs)

    return wrapper