def isHTML(str):
    """Try to determine whether str is HTML or not."""
    s = str.lstrip().lower()
    if s.startswith('<!doctype html'):
        return True
    if s.startswith('<html') and s[5:6] in ' >':
        return True
    if s.startswith('<!--'):
        idx = s.find('<html')
        return idx > 0 and s[idx + 5:idx + 6] in ' >'
    else:
        return False
