def get_hq_start_end(seq, is_hq_f):
    """
    ..doctest:
    >>> def f(c): return c.isupper()
    >>> get_hq_start_end('', f)
    (0, 0)
    >>> get_hq_start_end('GC', f)
    (0, 2)
    >>> get_hq_start_end('aGCc', f)
    (1, 3)
    """
    start, end = 0, 0
    i = 0
    while i < len(seq):
        if is_hq_f(seq[i]):
            start = i
            break
        i += 1

    i = len(seq) - 1
    while i >= 0:
        if is_hq_f(seq[i]):
            end = i + 1
            break
        i -= 1
    return (start, end)