code: def race_and_age(data):
      # Filters rows without age data
      only_with_age = data["with_years_in_prison"].where(
          lambda r: r["age"] is not None
      )
  
      # Group by race
      race_groups = only_with_age.group_by("race")
  
      # Sub-group by age cohorts (20s, 30s, etc.)
      race_and_age_groups = race_groups.group_by(
          lambda r: "%i0s" % (r["age"] // 10), key_name="age_group"
      )
  
      # Aggregate medians for each group
      medians = race_and_age_groups.aggregate(
          [
              ("count", agate.Count()),
              (
                  "median_years_in_prison",
                  agate.Median("years_in_prison"),
              ),
          ]
      )
  
      # Sort the results
      sorted_groups = medians.order_by(
          "median_years_in_prison", reverse=True
      )
  
      # Print out the results
      sorted_groups.print_table(max_rows=10)
  
file_path: agate/exonerations.py
imports: import proof
  import agate
label_desc: Use image node_id 7 for calling a global function with example usage: race_and_age(data) without return types