def maps_outside_regions(read, regions):
    """
    Returns True if the given pysam read maps outside the range of the given
    regions.
    """
    return (
        (read.reference_start < regions[0].start and read.reference_end < regions[0].start) or
        (read.reference_start > regions[-1].end and read.reference_end > regions[-1].end)
    )