<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def location_based_search(self, lng, lat, distance, unit="miles", attribute_map=None, page=0, limit=50):
 """Search based on location and other attribute filters :param long lng: Longitude parameter :param long lat: Latitude parameter :param int distance: The radius of the query :param str unit: The unit of measure for the query, defaults to miles :param dict attribute_map: Additional attributes to apply to the location bases query :param int page: The page to return :param int limit: Number of results per page :returns: List of objects :rtype: list """


        #Determine what type of radian conversion you want base on a unit of measure
        if unit == "miles":
            distance = float(distance/69)
        else:
            distance = float(distance/111.045)

        #Start with geospatial query
        query = {
            "loc" : {
                "$within": {
                    "$center" : [[lng, lat], distance]}
                }
        }

        #Allow querying additional attributes
        if attribute_map:
            query = dict(query.items() + attribute_map.items())

        results = yield self.find(query, page=page, limit=limit)

        raise Return(self._list_cursor_to_json(results))