code: def execute_sparql_query(query, prefix=None, endpoint='https://query.wikidata.org/sparql',
                               user_agent=config['USER_AGENT_DEFAULT'], as_dataframe=False):
          
  
          if not endpoint:
              endpoint = 'https://query.wikidata.org/sparql'
  
          if prefix:
              query = prefix + '\n' + query
  
          params = {
              'query': '#Tool: PBB_core fastrun\n' + query,
              'format': 'json'
          }
  
          headers = {
              'Accept': 'application/sparql-results+json',
              'User-Agent': user_agent
          }
          response = requests.get(endpoint, params=params, headers=headers)
          response.raise_for_status()
          results = response.json()
  
          if as_dataframe:
              return WDItemEngine._sparql_query_result_to_df(results)
          else:
              return results
docs: Static method which can be used to execute any SPARQL query
          :param prefix: The URI prefixes required for an endpoint, default is the Wikidata specific prefixes
          :param query: The actual SPARQL query string
          :param endpoint: The URL string for the SPARQL endpoint. Default is the URL for the Wikidata SPARQL endpoint
          :param user_agent: Set a user agent string for the HTTP header to let the WDQS know who you are.
          :param as_dataframe: Return result as pandas dataframe
          :type user_agent: str
          :return: The results of the query are returned in JSON format