I'm trying to create a list of dicts with two data items.
The page I'm looking at has 37 matches for //div[@id='content']/*[self::p or self::h2]/a[2]; however, it only has 33 matches for 
//div[@id='content']/*[self::p or self::h2]/a[contains(@href,'game')]/img[@src]
The two xpaths have //div[@id='content']/*[self::p or self::h2] in common. I effectively only want to get the element matched for the first xpath if the second xpath is matched, and leave the 4 without the second element behind. 
I'm hoping that this can be accomplished with xpath but if not, could use some advice on writing a function that achieves this in python.
You could do the matching in XPath, and then simply take the resulting nodes parent in Python.
conditional xpath? need xpath if more specific xpath is matched