def get_phys_by_index(vnic, vnics, nics):
    """
    Uses information stored in the OCI VNIC metadata to find the physical
    interface that a VNIC is associated with.

    Parameters
    ----------
    vnic : dict
        The virtual interface card name.
    vnics : dict
        The list of virtual interface cards.
    nics : dict
        The list of available network interface cards.

    Returns
    -------
        str
            The interface name if found, None otherwise.

    """
    candidates = {}
    for v in vnics:
        if vnic['nicIndex'] == v['nicIndex']:
            candidates[v['macAddr'].lower()] = True

    for n, d in nics.items():
        if d['physical'] and d['mac'] in candidates and not d.get('physfn'):
            return n
    return None