import re


def does_support_tls(ip):
    """Check if IP supports TLS.

    Has abba sequence and no abba sequence inside the brackets.

    Examples:
    - abba[mnop]qrst supports TLS (abba outside square brackets).
    - abcd[bddb]xyyx does not support TLS (bddb is within square brackets,
        even though xyyx is outside square brackets).
    - aaaa[qwer]tyui does not support TLS (aaaa is invalid;
        the interior characters must be different).
    - ioxxoj[asdfgh]zxcvbn supports TLS (oxxo is outside square brackets,
        even though it's within a larger string).
    """
    sequence = r'(\w)(\w)\2\1'
    sequence_inside_brackets = r'''\[
                                   [a-z]*
                                   (\w)(\w)\2\1
                                   [a-z]*
                                   \]'''
    has_sequence = re.search(sequence, ip)
    return (not re.search(sequence_inside_brackets, ip, re.VERBOSE)
            and has_sequence
            and len(set(has_sequence.group())) == 2)