I don't like the idea of 
```
return pages_with_children.keys()
```

The reason for this is the fact that pages_with_children is a defaultdict, which means it's quite easy for some future developer to do a ```pages_with_children[some value]``` ignoring the fact that ```some value``` wasn't in the initial pages list. At the end of the day, being able to do this is the whole point of having a default dict.

I actually wanted to suggest replacing
```
        value = pages_dict.get(page_id, None)
        if value:
            result.extend(_get_descendants(pages_dict, value))
```
with
```
        result.extend(_get_descenants(page_dict, page_dict[page_id]))
```

but then realized the potential side effects.