def location_to_query(location, wildcard=True, tag='i4x'):
 query = location.to_deprecated_son(prefix='_id.', tag=tag)
 if wildcard:
  for (key, value) in query.items():
   if ((value is None) and (key != '_id.revision')):
    del query[key]
 return query

def location_to_query ( location , wildcard = True , tag = 'i4x' ) : query = location . to_deprecated_son ( prefix = '_id.' , tag = tag ) if wildcard : for ( key , value ) in query . items ( ) : if ( ( value is None ) and ( key != '_id.revision' ) ) : del query [ key ] return query
takes a location and returns a son object that will query for that location by subfields rather than subdoc .