def extract_id(*object_types):
def outer(func):<EOL><INDENT>def inner(*args, **kwargs):<EOL><INDENT>def id_of(x):<EOL><INDENT>return x.id if type(x) in object_types else x<EOL><DEDENT>new_args = [id_of(arg) for arg in args]<EOL>new_kwargs = {k: id_of(v) for k, v in kwargs.items()}<EOL>return func(*new_args, **new_kwargs)<EOL><DEDENT>return inner<EOL><DEDENT>return outer<EOL>
Decorator for extracting id from passed parameters for specific types.