<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _prioritize_plot_regions(region_bt, data, out_dir=None):
 """Avoid plotting large numbers of regions due to speed issues. Prioritize most interesting. XXX For now, just removes larger regions and avoid plotting thousands of regions. Longer term we'll insert biology-based prioritization. """

    max_plots = 1000
    max_size = 100 * 1000 # 100kb
    out_file = "%s-priority%s" % utils.splitext_plus(region_bt.fn)
    if out_dir:
        out_file = os.path.join(out_dir, os.path.basename(out_file))
    num_plots = 0
    if not utils.file_uptodate(out_file, region_bt.fn):
        with file_transaction(data, out_file) as tx_out_file:
            with open(tx_out_file, "w") as out_handle:
                for r in region_bt:
                    if r.stop - r.start < max_size:
                        if num_plots < max_plots:
                            num_plots += 1
                            out_handle.write("%s\t%s\t%s\n" % (r.chrom, r.start, r.stop))
    return out_file