def METHOD_NAME(snapshot, key_type="lineno", limit=10):
    snapshot = snapshot.filter_traces(
        (
            tracemalloc.Filter(False, "<frozen importlib._bootstrap>"),
            tracemalloc.Filter(False, "<unknown>"),
        )
    )
    top_stats = snapshot.statistics(key_type)
    out = ""
    out += "Top %s lines \n" % limit
    for index, stat in enumerate(top_stats[:limit], 1):
        frame = stat.traceback[0]
        out += "#%s: %s:\n\t%s: %.1f KiB" % (
            index,
            frame.filename,
            frame.lineno,
            stat.size / 1024,
        )
        line = linecache.getline(frame.filename, frame.lineno).strip()
        if line:
            out += "    %s \n" % line
    other = top_stats[limit:]
    if other:
        size = sum(stat.size for stat in other)
        out += "%s other: %.1f KiB \n" % (len(other), size / 1024)
    total = sum(stat.size for stat in top_stats)
    out += "Total allocated size: %.1f KiB \n" % (total / 1024)
    return out