code: def retrieve_stars(libraries, week_over_week):
      returned_values = {}
      dataset_dict = datasets["stars"]
  
      for library_name in libraries:
          dataset = dataset_dict[library_name]
  
          last_value = 0
          last_week = dataset[0]["week"]
          for i in dataset:
              if week_over_week and last_week == i["week"]:
                  continue
              if i["dates"] in returned_values:
                  returned_values[i["dates"]][library_name] = (
                      i["range"] - last_value
                  )
              else:
                  returned_values[i["dates"]] = {
                      library_name: i["range"] - last_value
                  }
  
              last_value = i["range"] if week_over_week else 0
              last_week = i["week"]
  
      returned_values = collections.OrderedDict(
          sorted(returned_values.items())
      )
      returned_values = link_values(libraries, returned_values)
      output = {
          l: [k[l] for k in returned_values.values()][::-1]
          for l in libraries
      }
      output["day"] = list(returned_values.keys())[::-1]
  
      # Trim down to a smaller number of points.
      output = {
          k: [
              v
              for i, v in enumerate(value)
              if i % int(len(value) / 100) == 0
          ]
          for k, value in output.items()
      }
      return output
  
file_path: gradio/demo/dashboard/helpers.py
imports: import collections
  from datetime import datetime
  from datasets import DatasetDict, load_dataset
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: retrieve_stars(libraries, week_over_week) and returns: output