code: def sql_query(sql_str, url=PUBLIC_URL, format="csv"):
      """Execute query
  
      Parameters
      ----------
      sql_str : string
          valid sql query
  
      url: string (optional)
          query url.  Default is http://cas.sdss.org query script
  
      format: string (default='csv')
          query output format
  
      Returns
      -------
      F: file object
          results of the query
      """
      sql_str = remove_sql_comments(sql_str)
      params = urlencode(dict(cmd=sql_str, format=format))
      return urlopen(url + "?%s" % params)
  
imports: from urllib.request import urlopen
  from urllib.parse import urlencode
label_desc: Use image node_id 2 for calling a global function with example usage: sql_query(sql_str, url, format) and returns: urlopen