'Query for exactly one spec that matches the query spec.
Raises an assertion error if more than one spec matches the
query. Returns None if no installed package matches.'

def query_one(self, query_spec, known=any, installed=True):

    concrete_specs = self.query(query_spec, known, installed)
    assert (len(concrete_specs) <= 1)
    return (concrete_specs[0] if concrete_specs else None)
