def intersects(region1, region2):
    """
    Check if two regions intersect.

    If regions share an end, they don't intersect unless one of the regions has zero length in which case they do
    intersect.

    Arguments:
    region1 -- a first region.
    region2 -- a second region.
    Returns True if regions intersect and False otherwise.
    """
    if region1.a == region1.b:
        return region2.a <= region1.a and region2.b >= region1.b
    if region2.a == region2.b:
        return region1.a <= region2.a and region1.b >= region2.b
    if region1.a >= region2.b:
        return False
    if region1.b <= region2.a:
        return False
    return True