<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_backend():
 """ Returns the actual django cache object johnny is configured to use. This relies on the settings only; the actual active cache can theoretically be changed at runtime. """

    enabled = [n for n, c in sorted(CACHES.items())
               if c.get('JOHNNY_CACHE', False)]
    if len(enabled) > 1:
        warn("Multiple caches configured for johnny-cache; using %s." %
             enabled[0])
    if enabled:
        return get_cache(enabled[0])
    if CACHE_BACKEND:
        backend = get_cache(CACHE_BACKEND)
        if backend not in CACHES:
            from django.core import signals
            # Some caches -- python-memcached in particular -- need to do a
            # cleanup at the end of a request cycle. If the cache provides a
            # close() method, wire it up here.
            if hasattr(backend, 'close'):
                signals.request_finished.connect(backend.close)
        return backend
    return cache