import re


def does_support_ssl(ip):
    """Check if IP supports SSL.

    Has aba sequence outside of the bracketed sections and corresponding
    bab sequence inside bracketed section.

    Examples:
    - aba[bab]xyz supports SSL (aba outside square brackets with
        corresponding bab within square brackets).
    - xyx[xyx]xyx does not support SSL (xyx, but no corresponding yxy).
    - aaa[kek]eke supports SSL (eke in supernet with corresponding kek in
        hypernet; the aaa sequence is not related, because the interior
        character must be different).
    - zazbz[bzb]cdb supports SSL (zaz has no corresponding aza, but zbz has
        a corresponding bzb, even though zaz and zbz overlap).
    """
    regex = r'''(\w)(\w)\1              # aba sequence
                [a-z]*                  # separating characters
                (\[[a-z]+\][a-z]+)*     # zero or more bracketed sections
                                        # followed by characters
                \[[a-z]*\2\1\2[a-z]*\]  # bracketed bab
                '''
    regex2 = r'''\[[a-z]*(\w)(\w)\1[a-z]*\]  # bracketed aba
                 ([a-z]+\[[a-z]+\])*         # zero or more bracketed sections
                 [a-z]*                      # separating characters
                 \2\1\2                      # bab sequence
                 '''
    has_sequence = (re.search(regex, ip, re.VERBOSE)
                    or re.search(regex2, ip, re.VERBOSE))
    if has_sequence:
        return has_sequence.group(1) != has_sequence.group(2)
    return False