code: def query_foursquare(point, max_distance, client_id, client_secret):
      
      if not client_id:
          return []
      if not client_secret:
          return []
  
      if from_cache(FS_CACHE, point, max_distance):
          return from_cache(FS_CACHE, point, max_distance)
  
      url = FOURSQUARE_URL % (client_id, client_secret, point.lat, point.lon, max_distance)
      req = requests.get(url)
  
      if req.status_code != 200:
          return []
      response = req.json()
  
      result = []
      venues = response['response']['venues']
  
      for venue in venues:
          name = venue['name']
          distance = venue['location']['distance']
          categories = [c['shortName'] for c in venue['categories']]
          result.append({
              'label': name,
              'distance': distance,
              'types': categories,
              'suggestion_type': 'FOURSQUARE'
          })
  
      # final_results = sorted(result, key=lambda elm: elm['distance'])
      foursquare_insert_cache(point, result)
      return result
docs: Queries Squarespace API for a location
  
      Args:
          point (:obj:`Point`): Point location to query
          max_distance (float): Search radius, in meters
          client_id (str): Valid Foursquare client id
          client_secret (str): Valid Foursquare client secret
      Returns:
          :obj:`list` of :obj:`dict`: List of locations with the following format:
              {
                  'label': 'Coffee house',
                  'distance': 19,
                  'types': 'Commerce',
                  'suggestion_type': 'FOURSQUARE'
              }