<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def invalidate(*tables, **kwargs):
 """Invalidate the current generation for one or more tables. The arguments can be either strings representing database table names or models. Pass in kwarg ``using`` to set the database."""

    backend = get_backend()
    db = kwargs.get('using', 'default')

    if backend._patched:
        for t in map(resolve_table, tables):
            backend.keyhandler.invalidate_table(t, db)