semi-working more complex query

KeyError: 'xsd'