rather than handle each case inside of this one method, could we break out the individual operations we're doing? For example, a standalone `select_subtree` function like this:

```ruby
def select_subtree(path_parts)
  attrs = map
  parts.each do |part|
    if next_subtree = attrs[part]
      attrs = next_subtree
    else
      return nil
    end
  end
end
```

Then each of the deep/strict/closest query methods can decide how they want to deal with the result.