code: def parse_redis_url(url):
      
  
      # create config with some sane defaults
      redis_config = {
          "DB": 0,
          "PASSWORD": None,
          "HOST": "localhost",
          "PORT": 6379,
          "SSL": False
      }
  
      if not url:
          return redis_config
  
      url = urlparse.urlparse(url)
      # Remove query strings.
      path = url.path[1:]
      path = path.split('?', 2)[0]
  
      if path:
          redis_config.update({"DB": int(path)})
      if url.password:
          redis_config.update({"PASSWORD": url.password})
      if url.hostname:
          redis_config.update({"HOST": url.hostname})
      if url.port:
          redis_config.update({"PORT": int(url.port)})
      if url.scheme in ['https', 'rediss']:
          redis_config.update({"SSL": True})
  
      return redis_config
docs: Parses a redis URL.