def check_cache(resource_type):
def decorator(func):<EOL><INDENT>@functools.wraps(func)<EOL>def wrapper(*args, **kwargs):<EOL><INDENT>try:<EOL><INDENT>adapter = args[<NUM_LIT:0>]<EOL>key, val = list(kwargs.items())[<NUM_LIT:0>]<EOL><DEDENT>except IndexError:<EOL><INDENT>logger.warning("<STR_LIT>")<EOL><DEDENT>else:<EOL><INDENT>index_key = (resource_type, key, val)<EOL>try:<EOL><INDENT>cached_record = adapter._swimlane.resources_cache[index_key]<EOL><DEDENT>except KeyError:<EOL><INDENT>logger.debug('<STR_LIT>'.format(index_key))<EOL><DEDENT>else:<EOL><INDENT>logger.debug('<STR_LIT>'.format(cached_record))<EOL>return cached_record<EOL><DEDENT><DEDENT>return func(*args, **kwargs)<EOL><DEDENT>return wrapper<EOL><DEDENT>return decorator<EOL>
Decorator for adapter methods to check cache for resource before normally sending requests to retrieve data

    Only works with single kwargs, almost always used with @one_of_keyword_only decorator

    Args:
        resource_type (type(APIResource)): Subclass of APIResource of cache to be checked when called