def get_by_lcp_name(yaml, lcpname):
    """Returns the interface or sub-interface by a given lcp name, or None,None if it does not exist"""
    if not "interfaces" in yaml:
        return None, None
    for ifname, iface in yaml["interfaces"].items():
        if "lcp" in iface and iface["lcp"] == lcpname:
            return ifname, iface
        if not "sub-interfaces" in iface:
            continue
        for subid, sub_iface in yaml["interfaces"][ifname]["sub-interfaces"].items():
            sub_ifname = f"{ifname}.{int(subid)}"
            if "lcp" in sub_iface and sub_iface["lcp"] == lcpname:
                return sub_ifname, sub_iface
    return None, None