def _get_elements_by_query(api, query, recurse_down=True):
    """ Runs a query and returns the resulting OSM XML.

      api - an initialised Overpass API object
      query - the OverpassQL query
      recurse_down - whether to get child nodes of ways and relations
    """
    result = api.Get('%s%s' % (query, '(._;>;);' if recurse_down else ''),
        responseformat='xml')
    return result
