import ipaddress


def get_bridge_domain(aci_subnets, eip):
    """
    function to return a bridge domain name from tenant, app and end device IP
    :param aci_subnets: List of aci subnets
    :param eip: ACO end device IP
    :return: Bridge domain name
    """
    for bd_name, networks in aci_subnets.items():
        for network in networks:
            if ipaddress.ip_address(eip) in ipaddress.IPv4Network(network.addr, strict=False):
                return bd_name

    return None