def hits_do_overlap(new_hit, hit, overlap_cutoff):
    """Returns True if query sequence of new_hit DiamondHit overlap
    by at least 'overlap_cutoff' base pairs with query sequence of
    hit DiamondHit. Otherwise, returns False.

    Args:
        new_hit(:obj:'DiamondHit'): a hit to be tested
        hit(:obj:'DiamondHit'): a hit to be tested on
        overlap_cutoff(int): minimal length of a common area between
            hits to be considered overlapping

    Returns:
        result(bool)

    """
    new_hit_start = new_hit.q_start
    new_hit_end = new_hit.q_end
    start = hit.q_start
    end = hit.q_end
    result = True
    if new_hit_start < new_hit_end:
        # existing hit on + strand
        if start > end:
            # hits on different strands: no overlap
            result = False
        # hits on + strand
        elif end < (new_hit_start + overlap_cutoff):
            result = False
        elif start > (new_hit_end - overlap_cutoff):
            result = False
        else:
            return True  # overlap
    if new_hit_start > new_hit_end:
        # existing hit on - strand
        if start < end:
            # hits on different strands: no overlap
            result = False
        # hits on - strand
        elif start < (new_hit_end + overlap_cutoff):
            result = False
        elif end > (new_hit_start - overlap_cutoff):
            result = False
    return result