<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def no_duplicates(function, *args, **kwargs):
 """ Makes sure that no duplicated tasks are enqueued. """

    @wraps(function)
    def wrapper(self, *args, **kwargs):
        key = generate_key(function, *args, **kwargs)
        try:
            function(self, *args, **kwargs)
        finally:
            logging.info('Removing key %s', key)
            cache.delete(key)

    return wrapper