def _get_single_element_by_id(api, type, id, recurse_down=True):
    """ Retrieves a single OpenStreetMap element by its id.

      api - an initialised Overpass API object
      type - the element type to query, one of node, way or relation
      id - the id of the element to retrieve
      recurse_down - whether to get child nodes of ways and relations
    """

    # Construct query
    q = "%s(%d);%s" % (type, id, "(._;>;);" if recurse_down else "")

    # Run query
    r = api.Get(q, responseformat="xml")

    # Return data
    return r