code: def sample_basketball_players():
      endpoint_url = "https://query.wikidata.org/sparql"
  
      query = """
      SELECT DISTINCT ?player ?playerLabel ?birth_year ?birthplaceLabel ?popularity WHERE {
        ?player wdt:P31 wd:Q5;                    # <- instance of human
               wdt:P641 wd:Q5372;                # <- sport: basketball
               wdt:P106 wd:Q3665646;             # <- occupation: basketball player
               wikibase:sitelinks ?popularity.   # <- popularity (site links)
        FILTER(?popularity >= 5)                 # <- filter by popularity > 20
        OPTIONAL { ?player wdt:P569 ?birth_date. BIND(YEAR(?birth_date) AS ?birth_year) } # <- birth year
        OPTIONAL { ?player wdt:P19 ?birthplace. } # <- birthplace
        SERVICE wikibase:label {
          bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
        }
      }
      """
  
      headers = {"Accept": "application/json"}
      response = requests.get(
          endpoint_url, params={"query": query}, headers=headers
      )
  
      if response.status_code != 200:
          raise Exception(
              f"Error: {response.status_code} - {response.reason}"
          )
  
      results = response.json().get("results", {}).get("bindings", [])
      players_info = [
          {
              "player_name": result.get("playerLabel", {}).get(
                  "value", ""
              ),
              "birth_year": int(
                  result.get("birth_year", {}).get("value", "0")
              )
              if result.get("birth_year")
              else None,
              "birthplace": (
                  result.get("birthplaceLabel", {}).get("value", "")
                  if result.get("birthplaceLabel")
                  else None
              ),
              "popularity": int(
                  result.get("popularity", {}).get("value", "0")
              )
              if result.get("popularity")
              else None,
          }
          for result in results
      ]
  
      return players_info
  
imports: import requests
  import os
  import pickle
  import random
  from tqdm import tqdm
  from nltk.corpus import words
label_desc: Use image node_id 3 for calling a global function with example usage: sample_basketball_players() and returns: players_info