Generates a cache key for a model instance.

def cache_key(model, pk):
    "Generates a cache key for a model instance."
    app = model._meta.app_label
    name = model._meta.module_name
    return 'api:{0}:{1}:{2}'.format(app, name, pk)