'Returns a copy of ``buf`` that retains only the sequences of English
alphabet and high byte characters that are not between <> characters.
Also retains English alphabet and high byte characters immediately
before occurrences of >.
This filter can be applied to all scripts which contain both English
characters and extended ASCII characters, but is currently only used by
``Latin1Prober``.'

@staticmethod
def filter_with_english_letters(buf):

    filtered = BytesIO()
    in_tag = False
    prev = 0
    for curr in range(len(buf)):
        buf_char = buf[curr:(curr + 1)]
        if (buf_char == '>'):
            in_tag = False
        elif (buf_char == '<'):
            in_tag = True
        if ((buf_char < '\x80') and (not buf_char.isalpha())):
            if ((curr > prev) and (not in_tag)):
                filtered.write(buf[prev:curr])
                filtered.write('    ')
            prev = (curr + 1)
    if (not in_tag):
        filtered.write(buf[prev:])
    return filtered.getvalue()
