def test_overlap(query, reference):
    """
    Takes two tuples of coordinates (a query and a reference) and returns a
    boolean indicating whether the query overlaps any part of the reference.

    Query overlaps reference if either the start or the end of the query falls
    between the reference range.
    >>> test_overlap((1, 4), (5, 10))
    False
    >>> test_overlap((1, 5), (5, 10))
    True
    >>> test_overlap((5, 9), (5, 10))
    True
    >>> test_overlap((9, 15), (5, 10))
    True
    >>> test_overlap((11, 15), (5, 10))
    False
    
    Query also overlaps reference when the query start occurs before the
    reference start and the query end occurs after the reference end.
    >>> test_overlap((1, 15), (5, 10))
    True
    """
    return (reference[0] <= query[0] <= reference[1] or
            reference[0] <= query[1] <= reference[1] or
            query[0] <= reference[0] <= reference[1] <= query[1])