code: def set_memcached_backend(self, config):
          
          # This is the preferred backend as it is the fastest and most fully
          # featured, so we use this by default
          config['BACKEND'] = 'django_pylibmc.memcached.PyLibMCCache'
          if is_importable(config['BACKEND']):
              return
          # Otherwise, binary connections can use this pure Python implementation
          if config.get('BINARY') and is_importable('django_bmemcached'):
              config['BACKEND'] = 'django_bmemcached.memcached.BMemcached'
              return
          # For text-based connections without any authentication we can fall
          # back to Django's core backends if the supporting libraries are
          # installed
          if not any([config.get(key) for key in ('BINARY', 'USERNAME', 'PASSWORD')]):
              if is_importable('pylibmc'):
                  config['BACKEND'] = \
                          'django.core.cache.backends.memcached.PyLibMCCache'
              elif is_importable('memcached'):
                  config['BACKEND'] = \
                          'django.core.cache.backends.memcached.MemcachedCache'
docs: Select the most suitable Memcached backend based on the config and
          on what's installed