def METHOD_NAME(profile_dir: pathlib.Path, first: int, last: int):
    if last < first:
        print("ERROR: first must be <= last when specifying slot range")
        return
    files = []
    for i in range(first, last + 1):
        files.append(str(profile_dir / ("slot-%05d.profile" % i)))
    output_file = "chia-hotspot-%d" % first
    if first < last:
        output_file += "-%d" % last
    print("generating call tree for slot(s) [%d, %d]" % (first, last))
    check_call(["gprof2dot", "-f", "pstats", "-o", output_file + ".dot"] + files)
    with open(output_file + ".png", "w+") as f:
        check_call(["dot", "-T", "png", output_file + ".dot"], stdout=f)
    print("output written to: %s.png" % output_file)