def parse_is_account_bimodal_response(resp):
    """
    Parse a response from RpcIsAccountBimodal.

    Returns (True, peer-addr) if the account is bimodal, (False, None)
    otherwise.
    """
    is_bimodal = resp["IsBimodal"]
    ip = resp["ActivePeerPrivateIPAddr"]

    if ip.startswith("[") and ip.endswith("]"):
        # IPv6 addresses come with brackets around them, IPv4 addresses do
        # not
        ip = ip[1:-1]

    return (is_bimodal, ip)