code: def _get_banks_to_remove(redis_server, bank, path=''):
      '''
      A simple tree tarversal algorithm that builds the list of banks to remove,
      starting from an arbitrary node in the tree.
      '''
      current_path = bank if not path else '{path}/{bank}'.format(path=path, bank=bank)
      bank_paths_to_remove = [current_path]
      # as you got here, you'll be removed
  
      bank_key = _get_bank_redis_key(current_path)
      child_banks = redis_server.smembers(bank_key)
      if not child_banks:
          return bank_paths_to_remove  # this bank does not have any child banks so we stop here
      for child_bank in child_banks:
          bank_paths_to_remove.extend(_get_banks_to_remove(redis_server, child_bank, path=current_path))
          # go one more level deeper
          # and also remove the children of this child bank (if any)
      return bank_paths_to_removf _get_banks_to_remove(redis_server, bank, path=''):
      '''
      A simple tree tarversal algorithm that builds the list of banks to remove,
      starting from an arbitrary node in the tree.
      '''
      current_path = bank if not path else '{path}/{bank}'.format(path=path, bank=bank)
      bank_paths_to_remove = [current_path]
      # as you got here, you'll be removed
  
      bank_key = _get_bank_redis_key(current_path)
      child_banks = redis_server.smembers(bank_key)
      if not child_banks:
          return bank_paths_to_remove  # this bank does not have any child banks so we stop here
      for child_bank in child_banks:
          bank_paths_to_remove.extend(_get_banks_to_remove(redis_server, child_bank, path=current_path))
          # go one more level deeper
          # and also remove the children of this child bank (if any)
      return bank_paths_to_remove
docs: A simple tree tarversal algorithm that builds the list of banks to remove,
      starting from an arbitrary node in the tree.