def distance(lat1, lon1, lat2, lon2, geoid):
    """
    Computes the distance between the points
    (lon1, lat1) and (lon2, lat2). This function
    used the :py:func:`mpl_toolkits.basemap.pyproj.Geod.inv`
    function.

    :param float lat1: latitude of the first point
    :param float lon1: longitude of the first point
    :param float lat2: latitude of the second point
    :param float lon2: longitude of the second point
    :param mpl_toolkits.basemap.pyproj.Geod geoid: :py:class:`mpl_toolkits.basemap.pyproj.Geod` object used to compute the distance
    :return: distance between the two points
    :rtype: float
    """
    output = geoid.inv(lon1, lat1, lon2, lat2)
    return output[-1]
