def recursive_create(path: nil)
      raise ArgumentError, "path is a required argument" if path.nil?

      result = zk.stat(path: path)
      case result.fetch(:rc)
      when Zookeeper::Constants::ZOK
        return
      when Zookeeper::Constants::ZNONODE
        recursive_create(path: File.dirname(path))
        result = zk.create(path: path)

        case result.fetch(:rc)
        when Zookeeper::Constants::ZOK, Zookeeper::Constants::ZNODEEXISTS
          return
        else
          raise Kazoo::Error, "Failed to create node #{path}. Result code: #{result.fetch(:rc)}"
        end
      else
        raise Kazoo::Error, "Failed to create node #{path}. Result code: #{result.fetch(:rc)}"
      end
    end
def recursive_create(path: nil)
      raise ArgumentError, "path is a required argument" if path.nil?

      result = zk.stat(path: path)
      case result.fetch(:rc)
      when Zookeeper::Constants::ZOK
        return
      when Zookeeper::Constants::ZNONODE
        recursive_create(path: File.dirname(path))
        result = zk.create(path: path)

        case result.fetch(:rc)
        when Zookeeper::Constants::ZOK, Zookeeper::Constants::ZNODEEXISTS
          return
        else
          raise Kazoo::Error, "Failed to create node #{path}. Result code: #{result.fetch(:rc)}"
        end
      else
        raise Kazoo::Error, "Failed to create node #{path}. Result code: #{result.fetch(:rc)}"
      end
    end
Recursively creates a node in Zookeeper, by recusrively trying to create its
 parent if it doesn not yet exist.